• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate-get() & load() in functionality

 
Reehan Lalkhanwar
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to fetch a few records. Some of them are saved in DB and some of them are still in Session as they are not yet committed.
  • get() - fetches from the DB, returns object on successful fetch or returns null otherwise.
  • load() - fetches from Session, returns object on successful fetch or throws an exception otherwise..


  • Is there any method on Hibernate Session which looks in the Session and then also in DB and then returns null if it cannot find the object?
     
    Reehan Lalkhanwar
    Ranch Hand
    Posts: 106
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Does org.hibernate.Criteria.uniqueResult() uses get() or load()?
    In other words, does it look only in the Session or only in DB?
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic