Hibernate version:
3.0 Final
Mapping documents:
parent class:
Code:
<class
name="AirSigmet"
table="AirSigmets">
<meta attribute="class-description" inherit="false">
@hibernate.class
table="AirSigmets"
</meta>
<id
name="airSigmetId"
type="java.lang.Integer"
column="airSigmetId" >
<meta attribute="field-description">
@hibernate.id
generator-class="native"
type="java.lang.Integer"
column="airSigmetId"
</meta>
<generator class="native" />
</id>
<!-- Associations -->
<set name="pointsSet" table="AirSigmetsPoints" sort="natural" lazy="false" inverse="false" fetch="join">
<key column="airSigmetId"/>
<one-to-many class="AirSigmetsPoint"/>
</set>
</class>
Points class:
Code:
<class
name="AirSigmetsPoint"
table="AirSigmetsPoints"
>
<meta attribute="class-description" inherit="false">
@hibernate.class
table="AirSigmetsPoints"
</meta>
<composite-id name="comp_id" class="AirSigmetsPointPK">
<meta attribute="field-description" inherit="false">
@hibernate.id
generator-class="native"
</meta>
<key-property
name="airSigmetId"
column="airSigmetId"
type="java.lang.Integer"
length="10">
<meta attribute="field-description">
@hibernate.property
column="airSigmetId"
</meta>
</key-property>
</class>
Name and version of the database you are using:
MySQL 3.23.49
The generated SQL (show_sql=true):
Hibernate: /* criteria query */ select this_.airSigmetId as airSigme1_8_1_, this_.icaoId as icaoId8_1_, this_.alphaChar as alphaChar8_1_, this_.receiptTime as receiptT4_8_1_, this_.creationTime as creation5_8_1_, this_.validTimeFrom as validTim6_8_1_, this_.validTimeTo as validTim7_8_1_, this_.airSigmetType as airSigme8_8_1_, this_.hazard as hazard8_1_, this_.severity as severity8_1_, this_.altitudeLow1 as altitud11_8_1_, this_.altitudeLow2 as altitud12_8_1_, this_.altitudeHi1 as altitudeHi13_8_1_, this_.altitudeHi2 as altitudeHi14_8_1_, this_.movementDir as movemen15_8_1_, this_.movementSpd as movemen16_8_1_, this_.rawAirSigmet as rawAirS17_8_1_, this_.postProcessFlag as postPro18_8_1_, pt1_.airSigmetId as airSigme1_9_0_, pt1_.pointIdx as pointIdx9_0_, pt1_.lat as lat9_0_, pt1_.lon as lon9_0_ from AirSigmets this_ inner join AirSigmetsPoints pt1_ on this_.airSigmetId=pt1_.airSigmetId where (this_.validTimeFrom<=? and this_.validTimeTo>=?) order by this_.receiptTime desc
Hibernate: /* load one-to-many AirSigmet.pointsSet */ select pointsset0_.airSigmetId as airSigme1_1_, pointsset0_.pointIdx as pointIdx1_, pointsset0_.airSigmetId as airSigme1_9_0_, pointsset0_.pointIdx as pointIdx9_0_, pointsset0_.lat as lat9_0_, pointsset0_.lon as lon9_0_ from AirSigmetsPoints pointsset0_ where pointsset0_.airSigmetId=?
...
The issue I'm running into is that I am getting back a much larger number of my parent class than should be coming back. Criteria.list() returns me a List of 425 objects, when only 30 or so have actually been instantiated when I print them out. Does anyone know what I'm doing wrong here? It appears to be repeatedly inserting the same objects into the List for some reason before giving it to me. I assume this is something simple, but I can't find any documentation regarding this issue.
Thanks!