-->
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: multi level manytoone and single query
PostPosted: Thu Jan 05, 2012 10:57 am 
Newbie

Joined: Fri Jul 28, 2006 6:41 am
Posts: 6
Hello all.
I have 3 classes

let's say Class A,B and C.

Class A has a manytoone to B and B has manytoone to C.

When i run a query by filtering all results of class A, it runs a select query for each row of class B.
Can't this be done in a single query?
I'm using

new Criterion[]{Restrictions.eq("id.companyId", companyId)}

for filter, not a string query and.

@ManyToOne( cascade = {CascadeType.ALL}, fetch = FetchType.EAGER )
@JoinColumn(name="COLUMNNAME")

for the 2 manytoone relations

Thnx in advance


Top
 Profile  
 
 Post subject: Re: multi level manytoone and single query
PostPosted: Thu Jan 05, 2012 3:12 pm 
Newbie

Joined: Fri Jul 28, 2006 6:41 am
Posts: 6
OK it seems that the problem exists because class A has an embeddedId being a manytoOne relationship. In all other cases left outer join is ok.
Any ideas how we can "force" it to be done there too?


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.