Hi,
Using hibernate 2.1.3, I have a relationship mapped as a <set/>. However, I prefer a <bag/> so I changed the mapping, changed the code to instantiate a net.sf.hibernate.collection.Bag, and re-deployed the application. Now I'm getting LazyInitializationExceptions...
From the mapping:
Code:
<bag
cascade="all"
inverse="true"
lazy="false"
name="billings"
>
<key column="POLIDX" />
<one-to-many class="Billing" />
</bag>
It used to be a <set/>, all I changed in the mapping was to replace the <set/> tag with a <bag/> tag.
Should I have changed more in the mapping?
The exception is:
Code:
net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection - no session or session was closed
at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:209)
at net.sf.hibernate.collection.PersistentCollection.read(PersistentCollection.java:71)
at net.sf.hibernate.collection.Bag.size(Bag.java:232)
at com.unisys.pdg.gi.incoming.ReceiveNewScheduleBean.removeObsoleteBillings(ReceiveNewScheduleBean.java:450)
at com.unisys.pdg.gi.incoming.ReceiveNewScheduleBean.storeBillings(ReceiveNewScheduleBean.java:355)
at com.unisys.pdg.gi.incoming.ReceiveNewScheduleBean.storePolicyAndBillings(ReceiveNewScheduleBean.java:332)
at com.unisys.pdg.gi.incoming.ReceiveNewScheduleBean.processIncomingMessage(ReceiveNewScheduleBean.java:151)
at com.unisys.pdg.gi.incoming.EJSLocalStatelessReceiveNewSchedule_1638c822.processIncomingMessage(Unknown Source)
at com.unisys.pdg.common.incoming.ReceiveMessageHelperBean.processMessage(ReceiveMessageHelperBean.java:185)
at com.unisys.pdg.common.incoming.EJSLocalStatelessReceiveMessageHelper_a67fe650.processMessage(Unknown Source)
at com.unisys.pdg.common.jms.ReceiveMessage.handleMessage(ReceiveMessage.java:643)
at com.unisys.pdg.common.jms.ReceiveMessage.onMessage(ReceiveMessage.java:376)
at com.ibm.ejs.jms.listener.MDBWrapper$PriviledgedOnMessage.run(MDBWrapper.java(Compiled Code))
at java.security.AccessController.doPrivileged(Native Method)
at com.ibm.ejs.jms.listener.MDBWrapper.callOnMessage(MDBWrapper.java(Compiled Code))
at com.ibm.ejs.jms.listener.MDBWrapper.onMessage(MDBWrapper.java(Compiled Code))
at com.ibm.mq.jms.MQSession.run(MQSession.java(Compiled Code))
at com.ibm.ejs.jms.JMSSessionHandle.run(JMSSessionHandle.java(Compiled Code))
at com.ibm.ejs.jms.listener.ServerSession.connectionConsumerOnMessage(ServerSession.java(Compiled Code))
at com.ibm.ejs.jms.listener.ServerSession.onMessage(ServerSession.java(Compiled Code))
at com.ibm.ejs.jms.listener.ServerSession.dispatch(ServerSession.java(Compiled Code))
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.ejs.jms.listener.ServerSessionDispatcher.dispatch(ServerSessionDispatcher.java(Compiled Code))
at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java(Compiled Code))
at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java(Compiled Code))
at com.ibm.ejs.jms.listener.ServerSession.run(ServerSession.java(Compiled Code))
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))
What other information do I need to post?
regards,
--Tim