-->
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: How can I map component subclasses?
PostPosted: Wed Oct 27, 2004 9:34 am 
Newbie

Joined: Wed Oct 27, 2004 7:29 am
Posts: 4
How can I map eg.Name subclasses? for example:
public ShortName extends Name
{
private String shortName;
...
}

Thanks for your time

Hibernate version:
2.1.6
Mapping documents:
<class name="eg.Person" table="person">
<id name="Key" column="pid" type="string">
<generator class="uuid.hex"/>
</id>
<property name="birthday" type="date"/>
<component name="Name" class="eg.Name"> <!-- class attribute optional -->
<property name="initial"/>
<property name="first"/>
<property name="last"/>
</component>
</class>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 27, 2004 11:30 am 
Regular
Regular

Joined: Tue Sep 28, 2004 6:34 pm
Posts: 50
Change component Name to a class (in mapping) and add relation one to one instead of component. Than subclass the Name.

Lukasz


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 28, 2004 3:32 am 
Newbie

Joined: Wed Oct 27, 2004 7:29 am
Posts: 4
That's a solution, but I can't store the name and subclasses data in the same table, How can I do that?


Top
 Profile  
 
 Post subject: Mapping
PostPosted: Thu Oct 28, 2004 11:59 am 
Newbie

Joined: Thu Oct 21, 2004 10:45 am
Posts: 11
I managed to map two classes, both of which inherit from a common base class, and one of which contains a List of the other, just by stepping through the example mappings at the end of the html manual.

For extending a class, make sure you define the base class first, then create your new mapping file with a <joined-class extends="ShortName" name="Name"> instead of the usual syntax. (I think - haven't got it in front of me for the moment.)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 29, 2004 3:40 am 
Newbie

Joined: Wed Oct 27, 2004 7:29 am
Posts: 4
That can work, I'm think about to separate it to another table, actually my problem is http://forum.hibernate.org/viewtopic.php?t=935729&highlight=quiz but this topic could help me since it's easier to understand, thanks a lot.


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.