-->
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: SQL LEFT JOIN in Hibernate
PostPosted: Thu Jun 18, 2009 12:28 am 
Newbie

Joined: Thu Jun 18, 2009 12:12 am
Posts: 1
I'm now using a method List<ProjectListBean> getAllProjectListBean() in ProjectDaoHibernate.java to get all ProjectListBean from a ProjectListBean class and I'm having a problem with writing this SQL query in Hibernate:
Code:
SELECT PROJECT.TITLE, CUSTOMER.NAME, GROUP.NAME, DOMAIN.NAME
LEFT JOIN CUSTOMER
ON  PROJECT.CUSTOMER_ID=CUSTOMER.ID
LEFT JOIN GROUP
ON PROJECT.GROUP_ID=GROUP.ID
LEFT JOIN DOMAIN
ON PROJECT.DOMAIN_ID=DOMAIN.ID
WHERE PROJECT.CODE is NULL

It's a SQL query LEFT JOIN PROJECT TABLE with three table CUSTOMER, GROUP and DOMAIN.
Can anyone show me how to write this query in hibernate? thank you very much!!!!


Top
 Profile  
 
 Post subject: Re: SQL LEFT JOIN in Hibernate
PostPosted: Thu Jun 18, 2009 5:28 am 
Newbie

Joined: Wed May 06, 2009 4:36 am
Posts: 3
Using SQL or HQL ?

I think u can add all the tables in the from part and the ON-parts in the
where statement. Of course that will get slower the more tables u query.

Afaik hibernate HQL can not join tables on any column like sql can.


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.