-->
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: Best Practices for Multiple SQL Joins
PostPosted: Mon Jun 20, 2005 12:07 pm 
Newbie

Joined: Sun Jun 19, 2005 4:31 pm
Posts: 2
Hibernate version:
hibernate-3.0.5

Hello,

I am looking for best practices when joining multiple tables in hibernate.
For instance, I would like to covert the following sql into a pojo called ProductInfo which takes the x.Data and x.ID as args.

Code:
select new x.DATA, x.ID from CONTENTINSTANCE ci, CONTENTTYPE ct, CONTENTINSTANCEREVISION cir, XMLDATA x WHERE ci.CONTENTTYPEID = ct.ID AND cir.CONTENTINSTANCEID = ci.ID AND cir.ID = x.ID AND ct.NAME = 'product'


My high level questions are:
Do I implement pojos for each table?
Is joining the optimal (least round trips to db) way to approach this?
Can I just make a pojo ProductInfo with Data and Id and do all the other join tables under the covers in my mapping doc?

Thanks in Advance.

C:\>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 20, 2005 1:22 pm 
Newbie

Joined: Sun Jun 19, 2005 4:31 pm
Posts: 2
Sorry about the bad sql statement; below is the revised:

Code:
select x.DATA, x.ID from CONTENTINSTANCE ci, CONTENTTYPE ct, CONTENTINSTANCEREVISION cir, XMLDATA x WHERE ci.CONTENTTYPEID = ct.ID AND cir.CONTENTINSTANCEID = ci.ID AND cir.ID = x.ID AND ct.NAME = 'product'


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.