Hibernate load() and get() methods->
1) Both are from session interface and we call them as session.get() and session.load().
2) When we call session.load() method, it will always return a proxy object - hibernate prepares
a fake object without hitting the database.
It will hit the database only when we try to retrieve the properties of the object. If that
object is not found it will throw a ObjectNotFoundException.
3) When we call session.get() method, it will hit the database immediately and returns the original
object. If the row is not available in the database, it returns null.
1) Both are from session interface and we call them as session.get() and session.load().
2) When we call session.load() method, it will always return a proxy object - hibernate prepares
a fake object without hitting the database.
It will hit the database only when we try to retrieve the properties of the object. If that
object is not found it will throw a ObjectNotFoundException.
3) When we call session.get() method, it will hit the database immediately and returns the original
object. If the row is not available in the database, it returns null.
No comments:
Post a Comment