I am using hibernate to map 2 tables in a one-to-many relationship. I am attempting to get a list of Property objects. When I do this and look at the list of AuxProperties, I get a null values for each element of the aux_properties table that appears in the table prior to the matching row. Any ideas as to why it is putting all of these nulls in and how I might stop it from doing that?
a sample list looks like this:
null
null
null
null
null
null
7,XXXXXXX,R
but should only contain the last record when mapped with a standard join.
I am using Hibernate 3.0 on a MySql 4 database.
show_sql:
Hibernate: select auxpropert0_.ctyhocn as ctyhocn1_, auxpropert0_.id as id1_, auxpropert0_.id as id0_, auxpropert0_.ctyhocn as ctyhocn5_0_, auxpropert0_.property_type as property3_5_0_ from aux_property auxpropert0_ where auxpropert0_.ctyhocn in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: select auxpropert0_.ctyhocn as ctyhocn1_, auxpropert0_.id as id1_, auxpropert0_.id as id0_, auxpropert0_.ctyhocn as ctyhocn5_0_, auxpropert0_.property_type as property3_5_0_ from aux_property auxpropert0_ where auxpropert0_.ctyhocn in (?, ?, ?, ?)
<hibernate-mapping auto-import="true" default-lazy="false">
<class name="hilton.bus.Property" table="hotel" mutable="false">
<cache usage="read-only"/>
<id name="ctyhocn" type="string" column="ctyhocn">
<generator class="assigned" />
</id>
<property name="name" type="string" column="name" />
<list name="auxProperties">
<key column="ctyhocn" />
<index column="id"/>
<one-to-many class="hilton.bus.AuxProperty" />
</list>
</class>
</hibernate-mapping>
<hibernate-mapping auto-import="true" default-lazy="false">
<class name="hilton.bus.AuxProperty" table="aux_property" mutable="false">
<cache usage="read-only"/>
<id name="id" type="int" column="id">
<generator class="assigned" />
</id>
<property name="ctyhocn" type="string" column="ctyhocn"/>
<property name="propertyType" type="string" column="property_type"/>
</class>
</hibernate-mapping>
Any help would be greatly appreciated.
Dave
|