]
Gail Badner updated HHH-5007:
-----------------------------
Fix Version/s: (was: 3.6.1)
4.0.0.Alpha1
3.6.2
Using <formula> within Composite Element inside Collection
----------------------------------------------------------
Key: HHH-5007
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5007
Project: Hibernate Core
Issue Type: Patch
Components: core
Affects Versions: 3.5.0-CR-2, 3.5.1
Environment: 3.5.0-CR2, AS400, Component
Reporter: Hepoi Ko
Priority: Minor
Fix For: 3.6.2, 4.0.0.Alpha1
Attachments: hibernate-composite.zip, JoinWalker.java
I was one of the user who use Hibernate in a legacy database schema, and always had a
issue on using composite-key (and formula) inside collection. I was able to modify the
hibernate source (from 3.3.2) to overcome such issue. I am hoping the new version 3.5.0
would even fix this problem. Anyway, I just leave the fix information here, hope it would
help.
In /org/hibernate/loader/JoinWalker.java
Line 641: String[] aliasedLhsColumns = StringHelper.qualify(alias, lhsColumns);
Modify with these:
String[] fullAliasedLhsColumns = persister.getElementColumnNames(alias);
String[] aliasedLhsColumns = ArrayHelper.slice(fullAliasedLhsColumns, begin, length);
Without above change I would get NullPointerException on a mapping as
....
<set name="auditRecords" table="OEP40A" order-by="ADAT40
DESC, ATIM40 DESC"
mutable="false" inverse="true"
outer-join="true">
<key>
<column name="CONO40"></column>
<column name="ORDN40"></column>
</key>
<composite-element
class="com.ricoh.erp.order.domain.OrderAudit">
<property name="userId">
<column name="AUSR40"></column>
</property>
<property name="workstationId">
<column name="AWRK40"></column>
</property>
<many-to-one name="customerEntry"
not-found="ignore">
<formula>CONO40</formula> <!-- NullPointerException
on this line -->
<column name="CUSN40"></column>
<column name="DSEQ40"></column>
</many-to-one>
</composite-element>
With Best Regards,
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: