-->
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.  [ 3 posts ] 
Author Message
 Post subject: one-to-many returns only one child record. what am i missing
PostPosted: Wed Mar 24, 2004 3:57 pm 
Beginner
Beginner

Joined: Mon Mar 08, 2004 5:22 pm
Posts: 35
The following are my classes and mapping. Both these are VIEWS.
AUCTIONS view has information about the location & PRTDIRVIEW has the
info about the people working in the location.

When i individually extract the info for PRTDIRVIEW i used composite-id
like i showed below and worked fine. I used composite-id since view does
not have any single field unique. I am trying to relate
Place.ID with Person.AUCTID [1-to-many] which works fine but returns
only one person for the requested place.

Is there anyway out for this issue ? What i am missing here ?
Please let me know.



<hibernate-mapping>
<class name="com.auctioninfo.model.Place" table="dvpallo.AUCTIONS">
<id name="ID" type="string" unsaved-value="null">
<column name="ID" sql-type="char(32)" not-null="true" />
<generator class="uuid.hex" />
</id>
----
----
----
<set name="person">
<key-property name="AUCTID" />
<one-to-many class="com.auctioninfo.model.Person" />
</set>
</class>
<class name="com.auctioninfo.model.Person" table="PRTDIRVIEW">
<id name="AUCTID" type="string" unsaved-value="null">
<column name="AUCTID" sql-type="char(32)" not-null="true" />
<generator class="uuid.hex" />
</id>
<!-- PREVIOUS ID -->
<composite-id name="personName" class="com.auctioninfo.model.PersonPK">
<key-property name="PRTLNAME"/>
<key-property name="PRTFNAME"/>
<key-property name="AUCTID"/>
</composite-id>
----
----
----
</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 24, 2004 4:41 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
Quote:
<key-property name="PRTLNAME"/>
<key-property name="PRTFNAME"/>
<key-property name="AUCTID"/>


have you done all the change in the class too?
with composite id you needed equals & hashcode, have you delete the methods?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 24, 2004 4:50 pm 
Beginner
Beginner

Joined: Mon Mar 08, 2004 5:22 pm
Posts: 35
I had PersonPK class with composite-id items.
<key-property name="AUCTID" />
<key-property name="PRTLNAME" />
<key-property name="PRTFNAME" />

I have set/get methods for PersonPK in Person class.
I commented set/get methods and identifier.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.