[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-2432) Collection Mapping via "property-ref" on non-pk-column crashes
Oleg Gorobets (JIRA)
noreply at atlassian.com
Sun Nov 11 19:47:29 EST 2007
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2432?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oleg Gorobets updated HHH-2432:
-------------------------------
Attachment: testcase.zip
> Collection Mapping via "property-ref" on non-pk-column crashes
> --------------------------------------------------------------
>
> Key: HHH-2432
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2432
> Project: Hibernate3
> Issue Type: Bug
> Components: core
> Environment: 3.2.2, Sybase DB
> Reporter: Stefan Krinkel
> Attachments: testcase.zip
>
>
> Hi,
> when using the following example, Hibernate attempts to pull a "getTownId()" on an Integer!
> 2 Tables, Village and Councillor. Village has a comp. ID (TownId, VillageId), Councillor uses
> just the TownId-Part. To accomplish that, TOWN_ID is mapped twice (first in comp.key, second
> as "townCode"), to be able to do a 'property-ref'.
> When doing an ordinary "village.getCouncillors()" there's an IllegalArgumentException which
> roots to BasicPropertyAccessor.java:145
> public Object get(Object target) throws HibernateException {
> try {
> return method.invoke(target, null);
> }
> Here target is (Integer) townId and method is "VillageId.getTownId".
> <id name="id" type="integer">
> <column name="COUNCILLOR_ID" />
> <generator class="identity"/>
> </id>
> <property name="TOWN" type="integer" >
> <column name="TOWN_ID" not-null="true" />
> </property>
> ==============================================
> <composite-id name="VillageId" class="Table1Id">
> <key-property name="townId" type="integer">
> <column name="TOWN_ID" />
> </key-property>
> <key-property name="villageId" type="integer">
> <column name="VILLAGE_ID" />
> </key-property>
> </composite-id>
> <property name="townCode" type="integer" insert="false" update="false">
> <column name="TOWN_ID" />
> </property>
> <bag name="councillors" outer-join="false" inverse="false" >
> <key property-ref="townCode">
> <column name="TOWN_ID" not-null="true" />
> </key>
> <one-to-many class="COUNCILLOR" />
> </bag>
> Needless to say, it's a legacy database, so wildly changing tables is out of question for me, it has to
> work with hibernate.
> Thanks
--
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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list