File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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.?
 
Similar Threads
Cascade attribute's value
What is the best way to store List<List<String>> in database?
Struts - Hibernate integration
How to set a radio button selected from a JSP page, with the help of values extracted from database?
multiple condition in referencing collection in object using JPA