Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-3487

HHH-4825 wrong alias used in table-pre-class Inheritance strategy

    XMLWordPrintable

    Details

    • Affects:
      Release Notes
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      this is caused by the wrong alias generation when retrieving date from the ResultSet, Column.getAlias(Dialect) method will cut off the rest of letters after the first non-letter character, so map your collection column name to something else may resolve this problem
      or if you're working with a legacy system which you can not change the column name, then there are 2 options
      1. use another inheritance strategy
      2. change the order of property mapped in hbm (haven't test with annotations yet)

      Show
      this is caused by the wrong alias generation when retrieving date from the ResultSet, Column.getAlias(Dialect) method will cut off the rest of letters after the first non-letter character, so map your collection column name to something else may resolve this problem or if you're working with a legacy system which you can not change the column name, then there are 2 options 1. use another inheritance strategy 2. change the order of property mapped in hbm (haven't test with annotations yet)

      Description

      see http://opensource.atlassian.com/projects/hibernate/browse/HHH-4825
      this issue also exist in annotations, see JBPAPP-3560

      Following mapping fails:

      <hibernate-mapping default-access="property" package="case419703">

      <class abstract="false" dynamic-insert="true" dynamic-update="true" name="TestB"
      table="TEST_B">
      <composite-id class="case419703.key.FrameworkKeyCustID"
      name="frameworkKey">
      <key-property column="NR_RZBK" name="frameworkCustId"/>
      <key-property column="TXT_OID" name="frameworkOid"/>
      </composite-id>
      <version column="NR_VERSION" name="frameworkVersion"/>

      <set cascade="persist, merge, save-update" inverse="true" lazy="true" name="testC">
      <key>
      <column name="NR_RZBK"/>
      <column name="TXT_OID_TESTB"/>
      </key>
      <one-to-many class="TestC"/>
      </set>
      </class>

      <class abstract="true" dynamic-insert="true" dynamic-update="true" name="AbstractTestC"
      table="notable">
      <composite-id class="case419703.key.FrameworkKeyCustID"
      name="frameworkKey">
      <key-property column="NR_RZBK" name="frameworkCustId"/>
      <key-property column="TXT_OID" name="frameworkOid"/>
      </composite-id>
      <version column="NR_VERSION" name="frameworkVersion"/>

      <union-subclass dynamic-insert="true" dynamic-update="true" name="case419703.TestC"
      table="TEST_C">
      <property column="PID" name="pid" update="false"/>
      <property column="TXT_OID_TESTB" name="fkReverseTestB"/>
      <many-to-one cascade="persist, merge, save-update" class="case419703.TestB"
      fetch="select" insert="false" lazy="no-proxy" name="reverseTestB"
      update="false" >
      <column name="NR_RZBK" />
      <column name="TXT_OID_TESTB" />
      <!-- formula>'TXT_OID_TESTB'</formula-->
      </many-to-one>
      </union-subclass>
      </class>
      </hibernate-mapping>

      however changing to

      <many-to-one cascade="persist, merge, save-update" class="case419703.TestB"
      fetch="select" insert="false" lazy="no-proxy" name="reverseTestB"
      update="false" >
      <column name="NR_RZBK" />
      <column name="TXT_OID_TESTB" />
      <!-- formula>'TXT_OID_TESTB'</formula-->
      </many-to-one>
      <property column="PID" name="pid" update="false"/>
      <property column="TXT_OID_TESTB" name="fkReverseTestB"/>
      works.

      Something is wrong with th algo.
      See attached testcase.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  stliu Strong Liu
                  Reporter:
                  AnthonyHib Anthony Patricio
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: