-->
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: Id in base class
PostPosted: Thu Oct 20, 2005 11:20 am 
I've got a base class for my entity classes where the object's id is placed. I cannot understand how to map this. Is this even possible?

/R


Top
  
 
 Post subject:
PostPosted: Thu Oct 20, 2005 11:37 am 
Beginner
Beginner

Joined: Sat Apr 17, 2004 1:11 am
Posts: 36
You would map it as if the Id was in your derived class - because it is, essentially.

IOW, if BaseObject has an Id property and Emp extends BaseObject then you would just map Emp as if you defined Id on Emp.

benster


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 20, 2005 5:32 pm 
Newbie

Joined: Thu Oct 20, 2005 5:17 pm
Posts: 19
I create a mapping file to my base class as usual, then I add a <subclass> element with a discriminator-value attribute for each derived class. This is using a "table-per-class" hierarchy as described on page 99 of the Hibernate in Action book and in the documentation.

The Id is mapped as usual, as well as all properties in the base class. Unique fields for the sub-classes would be mapped under the appropriate <subclass> element.


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.