• Post Reply Bookmark Topic Watch Topic
  • New Topic

I want to join two different tables using DetachedCriteria  RSS feed

JayPrakash Dutta
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Joined: Jun 23, 2009
Messages: 1

[Post New]posted Today 10:28:13 IST
Quote Edit [Up]
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..

Mark Spritzler
Posts: 17309
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please don't duplicate post.

Also, I closed the other threads because they are posts from years ago. please don't resurrect old threads.

As for your question. It would be the same as you would with the Criteria object. Add Criterion objects to your Criteria object to create your query. use createAlias or addCriteria to your Criteria object to create joins.

Here are links to the Hibernate documentation that will help you learn about Criteria objects.




Good Luck

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!