id	summary	reporter	owner	description	type	status	priority	milestone	component	resolution	cc	remaining_time	sprint	drp_resources	o_links	i_links
118	Hibernate session.merge() is updating non-changed entities.	jmoore	jmoore	"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 [source:trunk/components/server/test/ome/server/itests/update/DetachedPixelsGraphTest.java@582 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 {
    createGraph();
    saveGraph();
    checkIds();
    checkVersions();
    checkLogs();
  }
}}}

Originally http://bugs.openmicroscopy.org.uk/show_bug.cgi?id=646"	task	assigned	critical	Cleanup	API		jburel cxallan					
