-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: failed to lazily initialize a collection of role exception
PostPosted: Wed Sep 05, 2007 1:32 pm 
Newbie

Joined: Wed Sep 05, 2007 1:23 pm
Posts: 4
I'm using Hibernate 3.2 in a JEE5 environment as my JPA provider. Unfortunately I have a recurring timer that looks up entities that have two bi-directional OneToMany mappings.

I was using TopLink Essentials and was hoping to make a smooth transition to Hibernate but it looks as if you can't have more then one OneToMany mapping with fetch=FetchType.EAGER set.

Code:
@OneToMany(cascade={CascadeType.ALL}, fetch=FetchType.EAGER, mappedBy = "owningILDA")


I tried setting one to be LAZY but then I end up getting:

Code:
Caused by: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of ro
le: ejb.entity.ILDAEntityBean.ilda15MinUpdates, no session or session was
closed
        at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(Ab
stractPersistentCollection.java:358)
        at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfN
otConnected(AbstractPersistentCollection.java:350)
        at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollec
tion.java:343)
        at org.hibernate.collection.AbstractPersistentCollection.write(AbstractPersistentCollection.
java:183)
        at org.hibernate.collection.PersistentBag.add(PersistentBag.java:274)
   


Is there another way around this besides switching back to TopLink Essentials which doesn't result in this problem?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 05, 2007 3:53 pm 
Newbie

Joined: Wed Sep 05, 2007 1:23 pm
Posts: 4
Anyone? Or I do I need to just stick with TopLink's em?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 06, 2007 1:11 pm 
Newbie

Joined: Wed Sep 05, 2007 1:23 pm
Posts: 4
Anyone?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.