This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes How To retrive data using Hibernate 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
Bookmark "How To retrive data using Hibernate" Watch "How To retrive data using Hibernate" New topic

How To retrive data using Hibernate

Pradyumna Khadanga

Joined: Aug 18, 2009
Posts: 5
Hi I want to write the following Query By using findByCriteria(Detached Criteria) to get the data
using Hibernate

"select a.organization_id From JCTS_PROJECT_INV a,JCTS_PROJECT c
where a.PROJECT_ID=c.PROJECT_ID and c.CUSTOMER_ID=4003640"

Please Help me .
Thanks & regards

Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Moving this to the ORM forum.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
Ganesh Shirsat
Ranch Hand

Joined: Jan 10, 2010
Posts: 33


List cats = sess.createCriteria(JCTS_PROJECT_INV .class)
.add( Restrictions.eq("CUSTOMER_ID", "4003640") )
.setFetchMode("JCTS_PROJECT ", FetchMode.EAGER)

i think this will help you. it will prepare the outer join query for JCTS_PROJECT_INV AND JCTS_PROJECT class.

It is sorta covered in the JavaRanch Style Guide.
subject: How To retrive data using Hibernate
jQuery in Action, 3rd edition