Warning: Can't synchronize with repository "(default)" (/home/git/ome.git does not appear to be a Git repository.). Look in the Trac log for more information.
Notice: In order to edit this ticket you need to be either: a Product Owner, The owner or the reporter of the ticket, or, in case of a Task not yet assigned, a team_member"

Task #118 (assigned)

Opened 18 years ago

Last modified 15 years ago

Hibernate session.merge() is updating non-changed entities.

Reported by: jamoore Owned by: jamoore
Priority: critical Milestone: Unscheduled
Component: API Version: 3.0-M1
Keywords: hibernate,versions Cc: jburel, cxallan
Resources: n.a. Referenced By: n.a.
References: n.a. Remaining Time: n.a.
Sprint: n.a.


It was found in r582 that calls to session.merge() were cascading to all instances so that versions in Experimenter, EventTypes, etc. are being incremented. This was hellish for clients trying to deal with optimistic locks.

This is a hibernate bug. See
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1401 (version 3.2 may help)

Revisions r590, r591, and r597 made temporary fixes so work could continue without versions.

Before we close this, we need to re-instate versions and finish the update tests (like DetachedPixelsGraphTest) which test the possible combinations of transient/detached graphs.

  • Transient root with:
    • transient entity
    • "transient" collection
    • unloaded entity
    • filtered collection (ERROR)
  • Detached root with:
    • transient entities/collections
    • detached entities/collections
    • filtered entities/collections

Also we need to make sure that the bug fix really worked, i.e.:

  • re-merging unchanged detached --> no version increment
  • re-merging changed --> version++ (also re: collections)

A possible Abstract test would be of the form:

  class {

Originally http://bugs.openmicroscopy.org.uk/show_bug.cgi?id=646

Change History (15)

comment:1 Changed 18 years ago by jmoore

  • Status changed from new to assigned

Need to try out newer (3.2.x) versions of Hibernate to see if this is fixed. Also important for security (#114) and the new model (#96). Moving to the next milestone:3.0-M3

comment:2 Changed 18 years ago by jmoore

  • Milestone changed from 3.0-M2 to 3.0-M3

comment:3 Changed 18 years ago by jmoore

Not having versions is again causing massive troubles from the client side. (Just versions would cause an equal number of stale object exceptions, but in combination with the client session should be seamless.)

An example of a problem is the following:

    Experimenter user1 = iAdmin.lookupExperimenter("user1")";
    Experimenter newUser = iAdmin.createUser( userDTO );
    // ... create an object belonging to user1
    iUpdate.saveObject( object ); 
    // which removes newUser from the user group! 

This happens because the set of GroupExperimenterMaps attached to user1 doesn't contain the new map from newUser to the user group. Since there is no version to tell Hibernate that the sets from user are stale, it removes the link. Boom'''

comment:4 Changed 18 years ago by jmoore

HHH-1564 appears to be related.

comment:6 Changed 18 years ago by jmoore

This is being fixed and is planned for Hibernate 3.2.1. There may be other issues: see HHH-85 (ref. the propery hibernate.batch_update_versioned)

comment:7 Changed 18 years ago by jmoore

  • Keywords iteration5 added

comment:8 Changed 18 years ago by jmoore

#81 might offer us another way out (update events)

comment:9 Changed 18 years ago by jmoore

If we go the #81 route (using update events) then rather then throwing a SecurityViolation it needs to throw an OptimisticLockException.

comment:10 Changed 18 years ago by jmoore

Note to previous comment: again if we got the #81 comment, we will have to prevent null update events for managed entities. I.e.

 * NullId/NullUpdateEvent    --> OK
 * NullId/NonNullUpdateEvent --> Not ok.
 * NonNullId/NullUpdateEvent --> Not ok.
 * Both non null             --> OK

comment:11 Changed 18 years ago by jmoore

  • Keywords iteration5 removed
  • Milestone changed from 3.0-M3 to Blocked

Still waiting on a response from the Hibernate team. Moving to milestone:Blocked

comment:12 Changed 17 years ago by jmoore

  • Milestone changed from Blocked to 3.0-M4

They say they've fixed it as of hibernate:r10740 . We need to test that. Rescheduling.

See also: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2217

comment:13 Changed 17 years ago by jmoore

  • Milestone changed from 3.0-Beta2 to 3.0-Beta3

This just got missed in milestone:3.0-Beta2. Certainly time to upgrade Hibernate versions.

comment:14 Changed 16 years ago by jmoore

  • Milestone changed from 3.0-Beta3 to 3.0-Beta4

We've upgraded, and this problem has not shown up again. However, versions still need to be reviewed. Pushing.

comment:15 Changed 15 years ago by jmoore

  • Milestone changed from OMERO-Beta4 to Cleanup
  • Priority changed from blocker to critical
Note: See TracTickets for help on using tickets. You may also have a look at Agilo extensions to the ticket.

1.3.13-PRO © 2008-2011 Agilo Software all rights reserved (this page was served in: 0.67147 sec.)

We're Hiring!