This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Shrikant Deshpande
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Find by example, or just do a regular HQL query. You should take in to account that you could get multiple results.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic