This content has been marked as final.
Show 4 replies
-
1. Re: Problem with lazy initialization - no session or session
scraatz Aug 29, 2006 8:52 AM (in response to korg)Are you accessing your lazy collections within a single Transaction? If not, that could be your problem...
-
2. Re: Problem with lazy initialization - no session or session
a_titov82 Sep 5, 2006 2:50 AM (in response to korg)I get this exception when I try to request collection of related entities (using EJB3 relations). When I try to access from local client (session bean) everything is ok. But when I try to access from remote client I get the exception...
Exception in thread "main" org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: my.Entity1.relatedCollection, no session or session was closed at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358) at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350) at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97) at org.hibernate.collection.PersistentBag.size(PersistentBag.java:222) at my.TestClient.main(TestClient.java:31)
Is it possible to access to the collection from remote client at all? -
3. Re: Problem with lazy initialization - no session or session
killme2008 Sep 5, 2006 5:53 AM (in response to korg)you have to try "Extended Persistence Contexts and Application Transactions",see the tutorial of jboss-ejb3-doc ,just like:
@PersistenceContext(type=PersistenceContextType.EXTENDED) EntityManager em;
by dennis -
4. Re: Problem with lazy initialization - no session or session
killme2008 Sep 5, 2006 5:55 AM (in response to korg)"killme2008" wrote:
you have to try "Extended Persistence Contexts and Application Transactions",read the tutorial of jboss-ejb3-doc ,just like:
@PersistenceContext(type=PersistenceContextType.EXTENDED) EntityManager em;
by dennis