-->
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.  [ 2 posts ] 
Author Message
 Post subject: failed to lazily initialize a collection using annotations
PostPosted: Mon Apr 24, 2006 10:15 am 
Newbie

Joined: Thu Jan 26, 2006 4:26 am
Posts: 16
Hello, im using Hibernate3.1.3 with Spring2.0. Also im using last version of annotations, but i have a problem, i always close the session at the end of the transaction (using Spring Interceptor), but when i try to retrieve a collection the exception:
Code:
org.hibernate.LazyInitializationException  - failed to lazily initialize a collection of role: com.dg.dg59.archival.model.staticinformation.User.privileges, no session or session was closed


is thrown. I know why this is happening, so in OneToOne and in classes attributes i used the annotated @Proxy(lazy=false) and because all data is loaded, the problem doesn't persists.

The problem is with collections, although im using FetchStrategy.EAGER, the exception is thrown. Can anybody tell me how to use Annotations for a lazyless approach?.

Thank you very much.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 26, 2006 9:37 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Code:

    @ManyToMany(mappedBy = "sources", fetch = FetchType.EAGER)



Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.