-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Getting null values when using list mapping
PostPosted: Tue Oct 25, 2005 6:36 pm 
Newbie

Joined: Tue Oct 25, 2005 6:23 pm
Posts: 2
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


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 7:07 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
please post your .equals() and hashCode() implementations .


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.