I have problem with duplicated rows in Hibernate generated SQL for one-to-many relation, though other similar one-to-many works! Please help!!!
The generated SQL:
select
details0_.DetailsData_FundCountryID as DetailsD1___,
details0_.DetailsData_FundID as DetailsD2___,
details0_.DetailsData_FieldID as DetailsD3___,
details0_.DetailsData_FundCountryID as DetailsD1_0_,
details0_.DetailsData_FundID as DetailsD2_0_,
details0_.DetailsData_FieldID as DetailsD3_0_,
details0_.DetailsData_Data as DetailsD4_0_
from
MMDetailsData details0_
where details0_.DetailsData_FundCountryID=? and details0_.DetailsData_FundID=?
Hibernate version:
2.1.7
Mapping documents:
In Fund.xml:
<set name="Details" lazy="true" cascade="none">
<key>
<column name="DetailsData_FundCountryID"/>
<column name="DetailsData_FundID"/>
</key>
<one-to-many class="my.test.DetailsData"/>
</set>
The whole DetailsData.xml:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping package="my.test">
<class
name="DetailsData"
table="MMDetailsData"
>
<composite-id name="id" class="DetailsDataPK">
<key-property
name="DetailsdataFundcountryid"
column="DetailsData_FundCountryID"
type="string"
length="3"
/>
<key-property
name="DetailsdataFundid"
column="DetailsData_FundID"
type="integer"
/>
<key-property
name="DetailsdataFieldid"
column="DetailsData_FieldID"
type="integer"
/>
</composite-id>
<property
name="DetailsdataData"
column="DetailsData_Data"
type="string"
not-null="false"
/>
</class>
</hibernate-mapping>
Name and version of the database you are using:
Sybase ASE 12.5.
|