Hi,
I passed from Hibernate 3.0 to Hibernate 3.3.1 and I have this problem:
I'm using websphere 6.1 with EJB.
In the previous version all worked good, if I load an entity with a children collection inside (with lazy propert set to true) if I try to get this collection outside the ejb like in a servlet or somewhere else I got LazyInitializationError and this is ok! now with this version I don't get this error, it's like the session remaing opened in the children collections of the entity loaded, and I have a problem updating or deleting this entity I got the error:
Illegal attempt to associate a collection with two open sessions
May be it's a configuration problem? this is my configuration:
Code:
<?xml version="1.0" encoding="utf-8"?>
<hibernate-configuration>
<session-factory>
<!-- datasource connection properties -->
<property name="session_factory_name">
hibernate/EmsgSessionFactory
</property>
<property name="transaction.manager_lookup_class">
org.hibernate.transaction.WebSphereExtendedJTATransactionLookup
</property>
<property name="connection.provider_class">
it.capgemini.common.data.dao.hbn.HibernateDataSourceProvider
</property>
<property name="connection.datasource">jdbc/EMsgDB</property>
<property name="dialect">
org.hibernate.dialect.Oracle9iDialect
</property>
<property name="hibernate.show_sql">false</property>
<property name="default_schema">EMSG</property>
<property name="hibernate.jdbc.use_streams_for_binary">true</property>
<property name="hibernate.bytecode.use_reflection_optimizer">false</property>
<property name="hibernate.transaction.auto_close_session">true</property>
<mapping file="db/mappings/Scheduler.hbm.xml" />
<mapping file="db/mappings/Canale.hbm.xml" />
<mapping file="db/mappings/SistemaArea.hbm.xml" />
<mapping file="db/mappings/Messaggio.hbm.xml" />
<mapping file="db/mappings/MessaggioBinary.hbm.xml" />
<mapping file="db/mappings/Servizio.hbm.xml" />
<mapping file="db/mappings/Errore.hbm.xml" />
<mapping file="db/mappings/Menu.hbm.xml" />
<mapping file="db/mappings/DettaglioStato.hbm.xml" />
<mapping file="db/mappings/StatoTemplate.hbm.xml" />
<mapping file="db/mappings/Formato.hbm.xml" />
<mapping file="db/mappings/DettaglioServizio.hbm.xml" />
</session-factory>
</hibernate-configuration>
and in this case Canale.hbm.xml
Code:
?xml version="1.0"?>
<hibernate-mapping>
<class name="it.capgemini.emsg.common.vo.data.Canale" table="CANALE">
<id name="canCodice" type="java.lang.Long">
<column name="CAN_CODICE" precision="10" scale="0" />
<generator class="sequence">
<param name="sequence">CANALE_SEQ</param>
</generator>
</id>
<property name="canDescrizione" type="string">
<column name="CAN_DESCRIZIONE" length="50" not-null="true" />
</property>
<property name="canDescBreve" type="string">
<column name="CAN_DESC_BREVE" length="10" not-null="true" />
</property>
<property name="canSigla" type="string">
<column name="CAN_SIGLA" length="5" not-null="true" />
</property>
<property name="canFormatoIndirizzo" type="string">
<column name="CAN_FORMATO_INDIRIZZO" length="50" not-null="true" />
</property>
<set name="dettaglioServiziosForDsCanCodiceIn" inverse="true" cascade="all">
<key>
<column name="DS_CAN_CODICE_IN" precision="10" scale="0" not-null="true" />
</key>
<one-to-many class="it.capgemini.emsg.common.vo.data.DettaglioServizio" />
</set>
<set name="dettaglioServiziosForDsCanCodiceOut" inverse="true" cascade="all">
<key>
<column name="DS_CAN_CODICE_OUT" precision="10" scale="0" not-null="true" />
</key>
<one-to-many class="it.capgemini.emsg.common.vo.data.DettaglioServizio" />
</set>
</class>
</hibernate-mapping>