Hi,
We are migrating hibernate from 4.3.11 to 5.1.0 in our product. We identified one behavior change after pulling the new hibernate jar. After debugging the code, we found hibernate is ignoring the parameters inside generator when the generator is used inside collection-id of idbag. Is this a bug in 5.1 or is this an intentional change? I can't find any reference to this change after googling.
Below is an example mapping file. The first generator used under id is fine. Hibernate passes in all parameters configured when calling KeyGeneratorBasedIdentifierGenerator. The second generator used in collection-id of idbag doesn't work. None of the parameters are passed to KeyGeneratorBasedIdentifierGenerator.
Code:
<?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="domain.scalestructure">
<class name="ScaleStructureBean" table="SCALE_STRUCTURE">
<id name="id" column="ID">
<generator class="data.hibernate.KeyGeneratorBasedIdentifierGenerator">
<param name="domain">RO</param>
<param name="name">BUSINESS_OBJECT_ID</param>
<param name="type">long</param>
</generator>
</id>
<property name="scaleCurrencyCode" type="string" column="NEW_SCALE_CURRENCY_CODE" />
<property name="scaleUomCode" type="string" column="NEW_SCALE_UOM_CODE" />
<idbag name="ScaleTiers" table="SCALE_TIER" order-by="THRESHOLD" batch-size="200">
<collection-id type="long" column="ID">
<generator class="data.hibernate.KeyGeneratorBasedIdentifierGenerator">
<param name="domain">RO</param>
<param name="name">BUSINESS_OBJECT_ID</param>
<param name="type">long</param>
</generator>
</collection-id>
<key column="SCALE_STRUCTURE_ID"/>
<composite-element class="domain.scalestructure.ScaleTierBean">
<property name="changeFlag" type="ChangeFlag" column="CHANGE_FLAG"/>
</composite-element>
</idbag>
</class>
</hibernate-mapping>