-->
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.  [ 10 posts ] 
Author Message
 Post subject: Left Joins with unrelated entities in Hibernate
PostPosted: Sat Oct 07, 2017 4:46 am 
Newbie

Joined: Sat Oct 07, 2017 3:45 am
Posts: 5
how to use left joins with unrelated entities in hibernate


Top
 Profile  
 
 Post subject: Re: left joins with unrelated entities in hibernate
PostPosted: Sat Oct 07, 2017 7:03 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
Since Hibernate 5.1 you can do this:

Code:
select ...
from FinancialRecord f
    left join User u
        on r.lastUpdateBy = u.username


Before 5.1, you could do equijoins (INNER JOINS) like this:

Code:
select ...
from FinancialRecord f, User u
where
    r.lastUpdateBy = u.username


Top
 Profile  
 
 Post subject: Re: left joins with unrelated entities in hibernate
PostPosted: Sat Oct 07, 2017 7:41 am 
Newbie

Joined: Sat Oct 07, 2017 3:45 am
Posts: 5
Before 5.1, you could do it like this:
select ...
from FinancialRecord f, User u
where
r.lastUpdateBy = u.username


The above query is inner join .

select ...
from FinancialRecord f
left join User u
on r.lastUpdateBy = u.username

The above query is not working in Hibernate 3.x


Top
 Profile  
 
 Post subject: Re: left joins with unrelated entities in hibernate
PostPosted: Sat Oct 07, 2017 8:09 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
Hibernate 3.x or 4.x are no longer supported, so you should upgrade to 5.x.


Top
 Profile  
 
 Post subject: Re: left joins with unrelated entities in hibernate
PostPosted: Sat Oct 07, 2017 8:39 am 
Newbie

Joined: Sat Oct 07, 2017 3:45 am
Posts: 5
Is Hibernate Support nvarchar type?


Top
 Profile  
 
 Post subject: Re: left joins with unrelated entities in hibernate
PostPosted: Sat Oct 07, 2017 8:49 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
Yes, it does. And a lot more.


Top
 Profile  
 
 Post subject: Re: left joins with unrelated entities in hibernate
PostPosted: Sat Oct 07, 2017 8:56 am 
Newbie

Joined: Sat Oct 07, 2017 3:45 am
Posts: 5
How to use nvarchar type in hibernate?

and what is the procedure?


Top
 Profile  
 
 Post subject: Re: left joins with unrelated entities in hibernate
PostPosted: Sat Oct 07, 2017 9:09 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
Did you read the User Guide and still couldn't find the answer to your question?


Top
 Profile  
 
 Post subject: Re: Left Joins with unrelated entities in Hibernate
PostPosted: Tue Oct 10, 2017 4:05 am 
Newbie

Joined: Tue Jun 12, 2007 5:22 am
Posts: 3
Hi Vlad!
Is joining unrelated entites supported by type safe criteria queries also?
I could not find any hint in http://docs.jboss.org/hibernate/orm/5.2 ... l#criteria so I assume not!?

thomas


Top
 Profile  
 
 Post subject: Re: Left Joins with unrelated entities in Hibernate
PostPosted: Wed Oct 11, 2017 9:17 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
I haven't tested it with Criteria, but it should work with the non-type safe one. The type-safe is meant for associations not unrelated entities.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 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.