Hello, I have this problem with my object, when I try to add a element to a List in the Object, Hibernate say:
org.hibernate.HibernateException: collection was evicted
org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:40)
org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1430)
org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:176)
org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:48)
org.hibernate.collection.PersistentBag.toArray(PersistentBag.java:250)
java.util.ArrayList.addAll(ArrayList.java:434)
<b>The XML Object:</b>
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
.
.
.
<bag name="listaEstados"
table="lista_estados_carta_porte"
cascade="all" lazy="true">
<key>
<column name="nro_sucursal" unique="true"/>
<column name="nro_carta_porte" unique="true"/>
</key>
<one-to-many class="ListaEstadosCartaPorte"/>
</bag>
<b>The bean Object</b>
public class CartaPorte implements Serializable
{
.
.
private List listaEstados;
etc, etc....
the problem is this code:
List listaEstadosCP = new ArrayList();
listaEstadosCP.add(cp.getListaEstados()); <----- HERE
please, i need help with this....
Hibernate version: 3
Mapping documents: 3
|