File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply locked New topic

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

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

Thanks in advance
Amit Ghorpade

Joined: Jun 06, 2007
Posts: 2846

"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.

|Asking Good Questions|
JayPrakash Dutta

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 = and domain_manager_id = "+domainManagerID;

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

I agree. Here's the link:
subject: I want to join three tables using DetachedCriteria
It's not a secret anymore!