-->
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: How to map a one to many unidirectional association ?
PostPosted: Thu Jun 10, 2004 11:07 am 
Newbie

Joined: Tue Jun 08, 2004 3:51 am
Posts: 8
Hi


I would like to map an unidirectional one to many association with hibernate.
I found in the 18.3 Reference Chapter The Order to LineItem association which is what i m looking for.


Here is what i have Postcard contains a list of PostcardStatus:

Code:
<class name="PostcardHibernateAdapter" table="Postcard">
    <id name="databaseId" column="id" type="long" unsaved-value="null">
        <generator class="native"/>
    </id>
    <property name="originalText" column="originalText" type="text"/>
     
    <list name="postcardStatus" table="PostcardStatus">
        <key column="postcardId"/>
        <index column="status_number"/>
        <composite-element class="PostcardStatus">
            <property name="value" column="value" type="int" not-null="true"/>
            <property name="date" column="date" type="date" not-null="true"/>
            <property name="reason" column="reason" type="string" not-null="true"/>             
        </composite-element>
    </list>     
</class>


With this mapping, the status are not saved. What am i doing wrong ?

Any example of one to many unidirectional association will be greatly appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 10, 2004 11:20 am 
Beginner
Beginner

Joined: Mon Sep 29, 2003 10:32 pm
Posts: 35
Location: Toronto, Ontario
You may want to set the cascade property on the list.
Also check out this tutorial on relationships in Hibernate. http://www.xylax.net/hibernate/


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 10, 2004 11:29 am 
Newbie

Joined: Tue Jun 08, 2004 3:51 am
Posts: 8
Thanks for your answer.

I set cascade="all" but it does not work.

I am going to check the website :)


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.