Hi,
I receive an UnsupportedOperationException when I try to call
entityManager.merge(exam)
Here is a part of the stack trace:
anonymous wrote : java.util.AbstractList.clear(AbstractList.java:217)
| org.hibernate.type.CollectionType.replaceElements(CollectionType.java:445)
| org.hibernate.type.CollectionType.replace(CollectionType.java:524)
| org.hibernate.type.TypeFactory.replace(TypeFactory.java:482)
|
org.hibernate.event.def.DefaultMergeEventListener.copyValues(DefaultMergeEventListener.java:340)
|
org.hibernate.event.def.DefaultMergeEventListener.entityIsPersistent(DefaultMergeEventListener.java:153)
|
org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:126)
|
And a part of the JSF code:
<h:selectManyListbox id="providerList" value="#{exam.providerList}"
styleClass="field" required="true">
| <s:selectItems value="#{providers}" var="p" label="#{p.name}"/>
| <s:convertEntity />
| </h:selectManyListbox>
Where "providers" is received from a @Factory method and exam.providerList is
used with a getter/setter for the property
List<Provider> providerList
of the Exam entity.
I found that setProviderList() is called with an argument of type
Arrays$ArrayList which is immutable and does not override
AbstractList.remove(). This is the reason for the exception to occur.
I wanted to ask if some has seen the same problem and knows the solution. Maybe
there is something else that I'm not doing right.
I have also found a workaround which I consider very ugly. What I did was to
make a modification to setProviderList() so that it recognizes Arrays$ArrayList
and create a new ArrayList from it.
Any comments? Thanks in advance...
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4079190#4079190
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4079190
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user