-->
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: disable left outer join for secondary table
PostPosted: Fri Apr 11, 2008 4:26 pm 
Newbie

Joined: Thu May 05, 2005 11:54 pm
Posts: 3
Hi,

It seems Hibernate always uses left outer join to get the data from secondary table. Is there a way to let it use inner join?

Annotation:

@SecondaryTable(name = "SUB_CLASS_ONE",
pkJoinColumns = @PrimaryKeyJoinColumn(name = "SUB_CLASS_ONE_ID"))

Generated Query:

select
mainclass0_.MAIN_CLASS_ID as MAIN1_0_,
mainclass0_1_.SUB_CLASS_ONE_ID as SUB1_3_,
from
subclass_test.main_class mainclass0_
left outer join
subclass_test.Sub_Class_One mainclass0_1_
on mainclass0_.MAIN_CLASS_ID=mainclass0_1_.SUB_CLASS_ONE_ID
where
mainclass0_.MAIN_CLASS_ID=?

-thanks


Top
 Profile  
 
 Post subject: solution for disable left outer join for secondary table
PostPosted: Fri Apr 11, 2008 5:04 pm 
Newbie

Joined: Thu May 05, 2005 11:54 pm
Posts: 3
Hi,

I actually found out how to do it. Need to add this annotation:

@org.hibernate.annotations.Table(appliesTo = "second table name", optional = false)


-thanks


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.