-->
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: order-by is ignored in map collection
PostPosted: Tue Apr 19, 2016 1:27 pm 
Newbie

Joined: Mon Apr 18, 2016 10:31 pm
Posts: 3
Hi,

We encounter an issue for map mapping when migrating hibernate from 4.3.11 to 5.1.0. See an example mapping file below. We use a map with order-by. In 4.3.11 hibernate uses a LinkedHashMap for the map which reserves the order. With 5.1.0 it uses a HashMap inside PersistedMap class so that the order is lost. I debug the code and found out hibernate uses MapType instead of OrderedMapType as property type for this map. Is this a bug? How should I define the map to make Hibernate uses OrderedMapType as property type?

thanks

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="mapping">
<class name="MappingBean" table="REQUEST_ITEM">
<id column="ID" name="id">
<generator class="data.hibernate.KeyGeneratorBasedIdentifierGenerator">
<param name="domain">SO</param>
<param name="name">OBJECT_ID</param>
<param name="type">long</param>
</generator>
</id>
<property column="ATTRIBUTE_1" name="attributeValue1" type="string"/>
<property column="ATTRIBUTE_2" name="attributeValue2" type="string"/>

<map name="responseItemBeanMap" table="RESPONSE_ITEM" inverse="true" cascade="all-delete-orphan" order-by="PRIORITY,SCOPE_ID" batch-size="200">
<key column="REQUEST_ITEM_ID" not-null="true"/>
<map-key column="SCOPE_ID" type="integer"/>
<one-to-many class="ResponseItemBean"/>
</map>

</class>
</hibernate-mapping>


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.