Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
enterprise-app for Vaadin add-on
Hi everyone.
I'd like to introduce this new add-on I've been working on for some time. The add-on is a set of classes to help in the creation of CRUD interfaces with import and export options, reports (with jasper reports), audit logs, MDI like interfaces, and other features.
I've published an online demo at http://enterprise-app-example.cloudfoundry.com/.
Well... I hope It to be useful for reference on integrating technologies or for directly use in your own apps. Will appreciate any comments and suggestions.
Great looking add-on!
Would you be able to restart your demo app, it seems to be having some issues.
Hey thank you! I think the problem was a missing jar file (commons-io.jar) or a CloudFoundry issue.
I just published a new version of the add-on. Also, the demo app has a new feature: Server log files viewer.
Hi,
I'm interested by this add on,
I there a plan for other features to be added?
Hi. Thanks for your interest.
I'm developing this add-on based on other three software projects. Accordingly to the requeriments for these projects, I implement all the functionality that I think would be useful for other projects, in the add-on. So it's very likely that new features will appear as the other projects evolve. Now, what it's happening at this point with the add-on is that it has enough features to allow the development of the three products I'm involved on. So, I would say that in the future, the add-on will have a lot of bug-fixes and improvements over the current components rather than new ones.
Well done!
However, When I run the enterprise-app example and calling report, it comes accross with the problem "Unknown property 'city' error".
I know "city" is in "ContactInfo" model. Is there anyone can tell me how to resolve it.
Thanks.-_-
Hi. You are right. There was a regression bug in example application version 0.2.0. Fixed in 0.2.1.
Alejandro Duarte: Hi. You are right. There was a regression bug in example application version 0.2.0. Fixed in 0.2.1.
Thanks. 0.2.1 works well.
You reply very quickly!
Hi,
When I use the jasper reports module, the whole web application is blocked, it gives none response unless I restart the web server. Could you help me with this problem?
Thanks
Hi Feng.
Could you attach an example implementation so I can reproduce the problem?
Hi, awesome add-on, but I'm having issues with CRUD relationships, I have a onetomany relationship, And I want to get rows so can be displayed in a table in my CRUD interface, just like the example app, also, I saw you have spanish locale how can i use it in all the labels in my app? thank you very much
Cli class, has CLITELEFO, also Vta class has VTATELEFO, so i have a join between them in a onetomany relationship
Hi John.
What issues are you having?
In order to use the spanish locale (or any custom configuration file), you must define your own ServletContextListener extending enterprise-app's DefaultContextListener and overriding getPropertiesFileNames(). The following example will include spanish locale, and two custom configuration files:
public class MyContextListener extends DefaultContextListener {
@Override
public String[] getPropertiesFileNames() {
return new String[] {
"/defaultConfiguration-es.properties",
"/database.properties",
"/ui.properties"
};
}
}
Don't forget to change your web.xml accordingly:
<listener>
<listener-class>myapp.MyContextListener</listener-class>
</listener>
Ok, thanks, now I have my app in spanish locale, but I'm having the same situation with onetomany relations...
the first screeshot shows the relationship between tables,
the second one as you see it's the CRUD table of clientes, and it's working fine... actually the column ventas is fine, but as soon as I select a row with ventas on it, it never stop loading data.. and I got java.lang.OutOfMemoryError: Java heap space
Hi John.
@CrudField(embedded=true) only works if you map the property with @OneToMany(cascade=ALL, orphanRemoval=true). mappedBy is not currently supported for embedded EntityTable fields. If you need to keep your current mapping, you must implement your own field component and add it to the CRUD via a custom DefaultCrudFieldFactory.
thanks to your reply but I don't know how to do that, it's a little advanced to me, but thanks anyway, it's a nice add-on
Hi Alejandro,
Got some questions, How can I do queries with HbnContainer???
Hi John. You can extend DefaultHbnContainer and use all the protected *query() methods. Take a look at the classes inside the enterpriseapp.example.container package of the example application.
ok, thanks now I'm getting familiar with HQL, but there is a way to query in SQL? using your add-on...?
Of course. Hibernate session is exposed through sessionManager.getSession(), so you can use session.createSQLQuery(). Please refer to Hibernate documentation to get more details.
Nice, man you are helping me a lot, but now i have another question, in this case I got a Table with containerdatasoure that is a CliContainer form the entity Cli.java, and I want to get the selected values and put it on a separate CliContainer...
CliContainer clientes = (CliContainer) ExampleContainerFactory.getInstance().getContainer(Cli.class);
t.setContainerDataSource(clientes);
t.setSizeFull();
t.setImmediate(true);
t.setSelectable(true);
t.setMultiSelect(true);
t.addListener(new ItemClickListener() {
private static final long serialVersionUID = 1L;
public void itemClick(ItemClickEvent event) {
Object values = t.getValue();
if (values instanceof Set) {
Set selected = (Set) t.getValue();
for(Iterator it = selected.iterator(); it.hasNext();){
final Object id = it.next();
Item item = t.getItem(id);
}
how can i get a CliContainer that contains selected (selected Cli's) values from the table?
A container represents a place or repository of data. So, if you want a CliContainer instance to have only a sub-set of another CliContainer instance, it is not possible (unless this instances are attached to different data sources, wich is not the case here). You can however, create a BeanContainer to wich you can add the selected Cli instances.
Ok, I got it, I'm using BeanContainer, but i get an classcast exception enterpriseapp.hibernate.CustomHbnContainer$EntityItem cannot be cast to com.jarris.dto.Cli
BeanContainer<String, Cli> b = new BeanContainer<String, Cli>(Cli.class);
if (values instanceof Set) {
Set selected = (Set) t.getValue();
for(Iterator it = selected.iterator(); it.hasNext();){
Object id = it.next();
Item item = t.getItem(id);
b.addBean((Cli) item);
}
}
Hi.
Take a look at class enterpriseapp.hibernate.CustomHbnContainer.EntityItem.
Hi, I I'm looking that class, but I don't understand, can you give me a example please?
Sorry I'm a newbie
Hi John. Here is an example:
EntityItem item = (EntityItem) t.getItem(id);
b.addBean((Cli) item.getPojo());
Hope this helps.
Thanks, It works, but now another question (Sorry :()
Im now making another table of cli with this
CliContainer cli = (CliContainer) ExampleContainerFactory.getInstance().getContainer(Cli.class);
CrudTable<Cli> clientes= new CrudTable<Cli>(Cli.class, cli, new DefaultCrudFieldFactory());
but this table doesn't show Primary Key, Id from table, how can i show it on the table... thanks
Hi John. Would you be able to attach an example project?
Hi, you want the whole project I'm working? or just classes and db?
Hi, I'm having a lot of problems with relationships in tables, now I'm getting a org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.jarris.dto.Vta.vtls, no session or session was closed as you can see there's a new relation in table Vta, but now I'm getting this exception... I can send you the whole project? I'll reward you if you help me to finish this...
Hi John.
I would say that if you are having LazyInitializationExceptions, something is wrong in your code, not in the add-on. However I'd need to see your code to confirm that. Please send me a message using the contact form at http://alejandroduarte.weebly.com/contact-me.html to help you solve this issues more easyly.
Hi.
There's no maven pom yet. I will work on that once I publish a stable version.
Hi there,
i've a question concerning ManyToMany relations. I've configured such a relation like this:
In the Module i get something like this:
But i need something like that:
Only a component that selects the entry from Bunch and put a entry in the (ManyToMany) user_bunch table (set the relation) …
How can i do that?
Hi Mathias.
Implement your own DefaultCrudFieldFactory overriding createCustomField() to return a custom TwinColSelect for the "bunch" property. Pass an instance of your DefaultCrudFieldFactory to the CrudComponent (using a proper constructor or builder).
Here you got an example:
public class MyFieldFactory extends DefaultCrudFieldFactory {
@Override
public Field createCustomField(Object bean, Item item, String pid, Component uiContext, Class<?> propertyType) {
Field field = null;
if(User.class.isAssignableFrom(bean.getClass())) {
if("bunch".equals(pid)) { // replace "bunch" whith your actual property name in the User class
field = new TwinColSelect();
// TODO: populate TwinColSelect with data
}
}
return field;
}
}
Hope this helps.
Not right now. But I will start working on that when Vaadin 7 becomes a realease version.
Hi, i got the problem when viewing the report and press the Refresh button. Here what i got from catalina's log:
WARNING: Cannot serialize session attribute com.vaadin.terminal.gwt.server.WebApplicationContext for session 4AABF091BA1CC8168BB5DF1082B06E93
java.io.NotSerializableException: enterpriseapp.hibernate.DefaultSessionManager
Is it vaadin, jasper or other issue?
It's look like something wrong with my environment. i tried a small vaadin project & jasper report. it still didn't work. i have tried to change the enterpriseapp, lib, and jasper file. what i need is the enterprise app can show the report. I work with win7, netbeans 7.2, jdk 6, tomcat 7. does anyone ever meet the same problem?