Hibernate still issue an SQL Update query while setting value to the entity
Issue
-
While trying to update a record by setting some values into the entity and using
merge()method, update query has been executed before executingmerge()method. -
The entity which is used in this code is not detachable entity.
-
Even if
merge()statement has been omitted, still update query has been executed. -
Following is the sample code snippet for the same.
SmSession smSession = _em.find(SmSession.class, smSessionId);
//use some setters to update
smSession .setAAA(...)
smSession .setBBB(...)
//execute merge method to update the record
_em.merge(smSession);
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 5.x
- 6.x
- JBoss Hibernate
- 3.x
- 4.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
