-->
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.  [ 1 post ] 
Author Message
 Post subject: Sql Query problem When Join Colum is Null
PostPosted: Thu May 17, 2012 2:25 am 
Newbie

Joined: Fri Feb 24, 2012 3:11 am
Posts: 3
I have 3 classes.
A holds B.
C holds another B.
A holds "many" C.

B can be null or not null. While I save B to database I use native sqlinsert, sqlupdate, vs.. queries.

If B is null, I can find A, i can find C, but I cannot find C's of A.

when I look at the sql text, I can see that hibernate makes inner join for the last case. I mean

select ... from A inner join B where b.join_column=c.join_column.

But because of c.join column is null, returns zero-sized list.

but for the first case

select ... from A left outer join B where b.join_column=c.join_column.

and it works as i expected.

Could you give any solution for it?


Thank you for your help in advance,


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.