-->
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: Joining 3 tables
PostPosted: Thu Aug 01, 2013 2:20 am 
Newbie

Joined: Thu Aug 01, 2013 1:45 am
Posts: 1
Hi
I am new to hibernate.
My question is i need to run the following query in hibernate by joining table A with table B and table B with table C.
I am very confused about the syntax i should use to do the same.

SELECT A.log_date, A.uid, A.property, A.Property_value, C.type_id, C.name AS Name

FROM table_A A, table_B B, table_C C

WHERE A.uid = B.uid

AND B.Type_Id = C.type_id

where uid is PK of table B and Fk of table A.
type_id is PK of table C and FK in table B.
log_date,uid and property make composite keys in table A.

I have implemented the composite key logic and it works fine.

My question is can i use hibernate criteria to join the above tables or should i use join annotations inside the pojo for table A and run the query.
Request your help.


Top
 Profile  
 
 Post subject: Re: Joining 3 tables
PostPosted: Thu Aug 01, 2013 9:53 am 
Beginner
Beginner

Joined: Wed Feb 06, 2013 2:43 am
Posts: 46
You can use either of them.

Hibernate criteria is quite easy to understand.
And annotation is a bit difficult.

_________________
Thanks,
Ajit Singh
ajits@mindfiresolutions.com
www.mindfiresolutions.com


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.