Hi!
I would like to do something rather common but it doesn’t work. I have a user/unit relation. I use a table with JPAContainer to display the users and a form to edit them.
So i added a twin column select to my user detail form field factory. I changed the collection type of the relations to Set because i read somewhere in this forum that there’s a bug wich prevents the use of lists.
I populate the select with a simple JPA query followed by a foreach addItem() construction.
If i try to commit the form i get the following exception:
com.vaadin.data.Property$ConversionException: javax.persistence.PersistenceException: Exception [EclipseLink-6055]
(Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.QueryException
Exception Description: The method invocation of the method [protected native java.lang.Object java.lang.Object.clone() throws java.lang.CloneNotSupportedException]
on the object [[FSAutobau01, PJM, PJMLKW01, PJMR01, PJMR02, PJMR03, PJMRTS01, PJMTEST01, PJMTEST02, PJMTEST03, PJMUBLOX01]
], of class [class java.util.Collections$UnmodifiableSet]
, triggered an exception.
Internal Exception: java.lang.reflect.InvocationTargetException
What should i do? I also tried to populate the select with another JPAContainer. But this doesn’t work either. I think it’s the problem that JPAContainer uses the primary key as id but the select gets a set of complete unit objects. I also read this in some other thread here.
I think the next problem i will get is that only one side of the relation get’s updated on commit. But in some thread i found an implementation of an EntityProvider wich solves this problem.
What can i do against this exception? Is there a better way for handling such m:n relations?
Regards