-->
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: Joined-subclass inheritance with xdoclet
PostPosted: Wed Jul 14, 2004 12:01 pm 
Beginner
Beginner

Joined: Wed Jul 14, 2004 11:51 am
Posts: 43
Hi,

I am unable to generate the proper configuration files using xdoclet for inheritance (joined-subclass).

I have a class Person which inherits ContactInfo and I want to have the following mapping in my ContactInfo.hbm.xml:

<class name="ContactInfo" table="CONTACT_INFO">
<id name="id" type="long" column="CONTACT_ID">
<generator class="native"/>
</id>
<property name="email" column="EMAIL"/>
...
<joined-subclass name="Person" table="PERSON">
<key column="PERSON_ID"/>
...
</joined-subclass>
...
</class>

I therefore add the following xdoclet tags at the class level of Person:

/**
*
* @hibernate.class
* table="PERSON"
* @hibernate.joined-subclass
* @hibernate.joined-subclass-key column="CONTACT_INFO_FK"
*/
public class Person
extends com.agencebraque.util.contact.entities.ContactInfo
{...
}

Unfortunately I don't get the expected mapping. Instead of having the one I specified above, there is no difference in ContactInfo.hbm.xml (that there would be had I not used inheritance) but in Person.hbm.xml, the attributes and associations of ContactInfo are included.

Of course this is not what I am looking for. Anybody have an idea what xdoclet tags I have to put to get the joined-subclass inheritance because I figure I'm not using the tags correctly?

Otherwise if you could direct me to samples which use inheritance with hibernate and xdoclet I would very much appreciate it.

Thank you very much,

Francois


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 19, 2004 12:17 pm 
Regular
Regular

Joined: Thu Jul 08, 2004 1:21 pm
Posts: 68
Location: Recife - Pernambuco - Brazil
Hi, the relationship between People and ContactInfo seems more like composition than inheritance. So, if you decide chance it, create an one to one relationship. Any way, in your case, the Xdoclet tags are incompletes. The joined-subclass approach expected that you use a table per class. So, in tags you forget the table to People class, or better, this class tag is wrong. Try this:
Code:
/**
* @hibernate.joined-subclass table="PEOPLE_TABLE"
*
* @hibernate.joined-subclass-key column="CONTACT_INFO_FK"
*/
public class Person extends ContactInfo {...}


valeuz...

_________________
Marcos Silva Pereira
http://blastemica.blogspot.com


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.