-->
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: Different order loading from HQL and session.get()
PostPosted: Sun Apr 10, 2005 8:25 am 
Newbie

Joined: Mon Jan 12, 2004 10:06 am
Posts: 15
Hi all.

I'm using hibernate3 and trying to retrieve an Object which has another object in it. Something like:

<class A>
<many-to-one
name="B"
class="B"
cascade="all"
fetch="join"
update="true"
insert="true"
column="id_cod"
not-null="true"
/>

</class>

If I try to retrieve this object using HQL, I see (with Eclipse debugger) that Hibernate first create one object o type A and after that one object of type B.
But if I try session.get() the order is inverse, first B and after that, A. am I doing something that generate this behaviour? For me is important the order in which objects are created and for the second case Im having problems.

Thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 10, 2005 9:15 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
In general terms, session.get will use the mapping document to guide loading when using HQL the query has a large influence on the order. Having said that its a bit scary that you have a load dependency in your code as it would make it very be hard to maintain.


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.