[hibernate-issues] [Hibernate-JIRA] Created: (EJB-237) merge() causes version to increase

Olli Blackburn (JIRA) noreply at atlassian.com
Fri Oct 6 23:24:24 EDT 2006


merge() causes version to increase
----------------------------------

         Key: EJB-237
         URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-237
     Project: Hibernate Entity Manager
        Type: Bug

  Components: EntityManager  
    Versions: 3.2.0.cr2    
 Environment: Core 3.2 CR4
EM 3.2 CR2
HSQLDB 1.8.0.2 in memory
    Reporter: Olli Blackburn
 Attachments: Playpen.zip

I'm finding that calling merge() on an unmodified entity results in the entity being marked dirty and hence its version number is increased and an SQL UPDATE performed on it.

See the attached test case (packaged as a complete eclipse 3.2 project). Set EJB3_HOME, HIBERNATE_HOME and HSQLDB_HOME in your eclipse workspace preferences and then run the included PojoTest launcher to see it run.

The test populates the DB, does a select by name, merge, merge and select by name again. Each of these five steps is in its own Tx and entity manager. The pojo is not being modified (by my code) between the merge calls(), yet I get the following output (each print is before the commit following the operation):

findByUniqueName: pojo1 version=0
merge: pojo1 version=0
merge: pojo1 version=1
findByUniqueName: pojo1 version=2


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list