-->
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: Many to Many
PostPosted: Mon Sep 15, 2003 5:57 am 
Newbie

Joined: Mon Sep 15, 2003 5:22 am
Posts: 2
I've got 3 classes A, B and C and 2 many to many relations between A and B and between B and C. Both are not lazy.

When I do following:
open session
load an instance of B
close session
iterate over B.getCs()

it works fine. But when I do following:
open session
load an instance of A
close session
iterate over A.getBs()
iterate over B.getCs()

an exception is thrown:
net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection - no Session
when a try to access B.getCs()

A look at the traces shows that hibernate did not generate the SQL query to load the C objects.
Does hibernate not load the whole object tree ?
Am I doing something wrong ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 15, 2003 8:07 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
What you are doing _should_ work.

If this is Hibernate 2.1 (beta), and you are certain about this, submit the code to JIRA, and I will take a look. I did change the collection loading stuff recently ... though all my tests still pass ...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 15, 2003 8:24 am 
Newbie

Joined: Mon Sep 15, 2003 5:22 am
Posts: 2
Yes, I am using 2.1beta (2 or 3)
I switched back to 2.0.3, now it is ok.
I will submit my code to JIRA ...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 15, 2003 8:28 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Thanks. Appreciated.


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.