[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4825?page=c...
]
Strong Liu commented on HHH-4825:
---------------------------------
two ways of fixing this I guess:
1.
open the comment below:
[
http://anonsvn.jboss.org/repos/hibernate/core/trunk/core/src/main/java/or...]
{code}
public static int lastIndexOfLetter(String string) {
for ( int i=0; i<string.length(); i++ ) {
char character = string.charAt(i);
if ( !Character.isLetter(character) /*&& !('_'==character)*/ ) return
i-1;
}
return string.length()-1;
}
{code}
2. use Column.getAlias(Dialect,Table) instead of Column.getAlias(Dialect) in
org.hibernate.persister.collection.AbstractCollectionPersister.AbstractCollectionPersister(Collection,
CollectionRegionAccessStrategy, Configuration, SessionFactoryImplementor)
mapping order impacting behavior leading to bug
-----------------------------------------------
Key: HHH-4825
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4825
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.2, 3.5.0-Beta-3
Reporter: Anthony Patricio
Assignee: Strong Liu
Attachments: case419703.zip
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.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira