enterprise-app for Vaadin add-on

Ok John, so what’s the question? :grin:

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,
Is there a maven pom for this addon?

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.

Any plans to port this add-on to Vaadin 7?

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?