-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate should merge maps...
PostPosted: Tue Sep 15, 2009 2:32 pm 
Newbie

Joined: Tue Sep 15, 2009 2:20 pm
Posts: 1
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!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.