-->
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: select with joins (+)
PostPosted: Thu Dec 10, 2009 5:35 pm 
Newbie

Joined: Mon Oct 08, 2007 5:33 am
Posts: 1
Hi all!

I´m executing this kind of HQL:

Code:
select new ModelView(obj1.propA, obj1.obj2.propB) from Objeto obj1


There is a relation OneToOne beetwen obj1 and its relationship with obj2 defined like this:

Code:
public class Objeto{
...
@OneToOne(cascade = {CascadeType.ALL }, fetch = FetchType.LAZY)
@PrimaryKeyJoinColumn
private Object2 obj2;
...


All I need is that the query results even if obj2 is null... but the SQL generated is something like this:

select o1.propA, o2.propB
from object1 o1, object2 o2
where o1.id = o2.idrefo1

So, can´t I tell hibernate to generate the joins with (+), so if value is null, the relationships returns something. I have checked documentation and I´ve seen that optional is false by default.

Can somebody help me, please?


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.