If you have an entity that contains a java.util.Map mapped to a table, the map's data does *not* get merged if you call merge against that entity.
I'd like to report that as a bug, but I am checking here first to make sure I am not missing anything.
My entity mapping looks like this:
<hibernate-mapping package="com.my.package">
<class name="MyEntity" table="MY_TABLE">
....
<map name="myMap" table="MY_TABLE_MAP" access="field" lazy="false"> <key column="MY_TABLE_ID" /> <index column="NAME" type="string" length="50" /> <element column="VALUE" type="string" length="1000"/> </map>
.... </class> </hibernate-mapping>
The following code does not merge the contents of the map:
MyEntity myEntityInstance = new MyEntity();
myEntityInstance.setId("SomeId"); // Sets the id of an existing instance.
myEntityInstance.getMyMap.put("newKey", "newValue");
MyEntity mergedEntity = session.merge(myEntityInstance);
assertEquals("newValue", mergedEntity.getMyMap().get("newKey")) // Assertion fails!
|