• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

difference between 2 load methods in hibernate

 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the difference between the 2 load methods mentioned below:



&

 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As the docs say:

Return the persistent instance of the given entity class with the given identifier, assuming that the instance exists.

and

Read the persistent state associated with the given identifier into the given transient instance.

 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



Both of them results the same. But there is definately something internally
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, the results are not the same. One returns a new object, the other uses an existing detached instance.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic