wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes I want to join three tables using DetachedCriteria Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply locked New topic
Author

I want to join three tables using DetachedCriteria

Mansi Mishra
Ranch Hand

Joined: Dec 26, 2008
Posts: 50
I have three tables, namely Table1.class, Table2.class and Table3.class
They are each related to each other by foreign key references, say
Table1.C1=Table2.C1
Table2.C2=Table3.C2
Table1.C3=Table3.C3

I want to join these three tables to get columns C1,C2,C3...using DetachedCriteria and Projections...Any help is appreciated.

Thanks in advance
Mansi


http://splashpress.blogspot.com
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

"mansi speaking" welcome to Javaranch
please check your private messages for an important administrative matter. You can see them by clicking the My Private Messages link above.


SCJP, SCWCD.
|Asking Good Questions|
JayPrakash Dutta
Greenhorn

Joined: Jun 23, 2009
Posts: 5
Hi ,
Can any one help me an execution this query having JOIN using DetachedCriteria .
There two diffrent Table.
1) pinterface
2) snmpinterface

String query = "select snmpinterface.ipaddr, snmpinterface.snmpifdescr, snmpinterface.snmpifspeed, snmpinterface.snmpifindex, snmpinterface.snmpifname, snmpinterface.snmpphysaddr from ipinterface, snmpinterface where ipinterface.ismanaged='M' and snmpinterface.nodeid = ipinterface.nodeid and snmpinterface.snmpifindex = ipinterface.ifindex and snmpinterface.nodeid = '" +routerName +"'";

1) devices
2) categories

String query = "select deviceID, advnet_deviceName, CI_ID, CustomerId from devices , categories where devices.isActive = 1 and categories.categoryName='Router' and devices.subCategory = categories.id and domain_manager_id = "+domainManagerID;


Thanks in advance for any help you can give to me.I am waiting your reply..

Thanks
Jay
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I want to join three tables using DetachedCriteria