-->
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.  [ 4 posts ] 
Author Message
 Post subject: Different between @LazyCollection to fetch=FetchType.EAGER
PostPosted: Mon Apr 07, 2008 1:09 pm 
Beginner
Beginner

Joined: Mon Apr 07, 2008 12:49 pm
Posts: 33
Hey,
I am working with JPA in JBoss 4.2 and I wonder what is the difference between adding to @OneToMany annotation - fetch=FetchType.EAGER to add hibernate annotation - @LazyCollection(value=LazyCollectionOption.FALSE)?

As I understand they need to have the same behavior , but with the first option (fetch=FetchType.EAGER) I got the
Quote:
simultantantly fetching multiple bags exception
when hibernate try to build the session factory.

Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 07, 2008 6:51 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
http://www.hibernate.org/hib_docs/annotations/reference/en/html/entity.html#entity-hibspec-singleassoc-fetching

_________________
Emmanuel


Top
 Profile  
 
 Post subject: Thanks, i know this
PostPosted: Mon Apr 07, 2008 11:17 pm 
Beginner
Beginner

Joined: Mon Apr 07, 2008 12:49 pm
Posts: 33
I read this and as i undersatnd they are the same - so i still have my question - why with fetch = eager i got the :
simultantantly fetching multiple bags exception

and with - @LazyCollection(value=LazyCollectionOption.FALSE) i dont get this exception.

Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 09, 2008 11:42 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
They are not the same

@ManyTo[One|Many](fetch=FetchType.EAGER) = @LazyCollection(FALSE) + @Fetch(JOIN)

I imagine in your case, you have

@ManyTo[One|Many](fetch=FetchType.LAZY) + @LazyCollection(FALSE)
Which means @LazyCollection(FALSE) + @Fetch(SELECT)

_________________
Emmanuel


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