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 How To retrive data using Hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
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.

I agree. Here's the link:
subject: How To retrive data using Hibernate
It's not a secret anymore!