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>
|