- Transient
- Persistance
- Detached
Save() - hibernate function,it will return generated key
Persist() - JPA function works same as save(),return type is void
Merge() - JPA function,return type is void
Update() - hibernate function
saveOrupdate() - hibernate function
Different between session.get() and session.load():-
Actually, both functions are use to retrieve an object with different mechanism, of course.
1. session.load()
• It will always return a “proxy” (Hibernate term) without hitting the database. In Hibernate, proxy is an object with the given identifier value, its properties are not initialized yet, it just look like a temporary fake object.
• If no row found , it will throws an ObjectNotFoundException.
2. session.get()
• It always hit the database and return the real object, an object that represent the database row, not proxy.
• If no row found , it return null.
No comments:
Post a Comment