aspose file tools*
The moose likes Object Relational Mapping and the fly likes How to Find specific object using Hibernate from the database.? 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 Find specific object using Hibernate from the database.?" Watch "How to Find specific object using Hibernate from the database.?" New topic
Author

How to Find specific object using Hibernate from the database.?

Shrikant Deshpande
Greenhorn

Joined: May 17, 2010
Posts: 15
How to Find specific object and load data into that Object from underlying database using Hibernate?

For e.g If I don't know object's identifier and know only object's specific attribute value. Then how to retrive that object based on that attribute value using Hibernate?

Please give the syntax.
Gokul Nanthakumar
Ranch Hand

Joined: May 11, 2010
Posts: 56
if you have the object class and the id value

you can easliy load as below

session.load(obj.getClass(), id)

I did not understand what problem in your case
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Find by example, or just do a regular HQL query. You should take in to account that you could get multiple results.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Find specific object using Hibernate from the database.?