-->
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.  [ 5 posts ] 
Author Message
 Post subject: Mapping ID of parent as a property within a component
PostPosted: Wed Dec 17, 2003 9:05 am 
Newbie

Joined: Mon Sep 29, 2003 6:47 am
Posts: 7
Given the mapping:

Code:
<class name="Foo" table="foos">
    <id name="id" type="long" unsaved-value="0">
        <generator class="native"/>
    </id>

    <component name="fooInfo" class="FooInfo" >
        <property name="name" type="string"/>
    </component>
</class>


How can FooInfo contain the 'id' property of Foo ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2003 10:02 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Check the <parent> tag

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2003 10:05 am 
Newbie

Joined: Mon Sep 29, 2003 6:47 am
Posts: 7
So I should be using:

Code:
<class name="Foo" table="foos">
    <id name="id" type="long" unsaved-value="0">
        <generator class="native"/>
    </id>

    <component name="fooInfo" class="FooInfo" >
        <parent name="id"/>
        <property name="name" type="string"/>
    </component>
</class>


Hibernate's codegenerator doesn't output a accessor method for 'id' in my sourcefile, any ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2003 10:07 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
No parent give you a callback to Foo object.
If you only want id, then a property mapped in the same column with insert and update to false would do the job.

parent is a 2.1 feature, maybe the codegenerator isn't uptodate.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 30, 2004 10:56 pm 
Newbie

Joined: Fri Feb 27, 2004 6:17 pm
Posts: 11
emmanuel wrote:
No parent give you a callback to Foo object.
If you only want id, then a property mapped in the same column with insert and update to false would do the job.

parent is a 2.1 feature, maybe the codegenerator isn't uptodate.


I ran into this problem as well, using the Hibernate 2.1.2 and Hibernate Extensions 2.0.2. I didn't see any reference to this in the JIRA, shoud I add it, or is this fixed in CVS...?


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