-->
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: how do this with criteria-api
PostPosted: Thu Sep 11, 2008 9:15 am 
Beginner
Beginner

Joined: Thu Jun 14, 2007 4:33 am
Posts: 39
i wonder how this could be done with the criteria-api:

Code:
"select p.firstname, geo.zip_code from Person p
            join Address_Data geo on p.id = geo.person
            join Phone ph on p.id = ph.person"


Its a unidirectional association from Address_Data to Person:

example scennario:
Code:
class Person{String attrib;}
class AddressData{String attrib; Person person;}
class Phone{String attrib; Person person}


in plain SQL it doesnt matter which entity holds the foreign-key - the query remains the same, but using Criteria-API with unidirectional associations its a bit difficult i think..

i really would like to avoid bidirectional assoc.

dont get me wrong: i know how to set up a bidir. assoc. but i really just would like to avoid them in some cases;)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 11, 2008 4:33 pm 
Beginner
Beginner

Joined: Thu Jun 14, 2007 4:33 am
Posts: 39
found this on the net:
http://www.jumpingbean.co.za/blogs/mark/hibernate_hql_inner_join_on_clause

seems nothing has happened since then..


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.