-->
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: Inheritance mapping
PostPosted: Thu Oct 23, 2003 2:09 pm 
Newbie

Joined: Thu Oct 23, 2003 1:43 pm
Posts: 10
Location: Calgary, Alberta Canada
Hm, OK, I am a real newbie to this and am having problems determining how I create my mapping to get the desired behaviour I am looking for.

I have three java classes, one is a superclass of the other two. Each of the subclasses should map to their own database table, the superclass maps to no table at all but simply holds mapped properties common to the two subclasses. So I have an Animal superclass that holds properties common to the two subclass types Cat and Dog. There is no Animal table, just Cat and Dog tables (and this is legacy that I am dealing with so I can't change the table structures).

Do I use a subclass or joined-subclass mapping for this? I think I am to use joined-subclass mappings for Cat and Dog, but I don't see where in a joined-subclass mapping that I provide the table name and what mapping do I provide then for the Animal class since I don't want it mapped to a table at all?

Sorry if this is simple and obvious, but I'm not getting it.....


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 23, 2003 2:12 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Heh the documentation has never been real clear on this, its supposed to be "obvious". No special mapping is needed. Just two <class> mappings :)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 23, 2003 3:22 pm 
Newbie

Joined: Thu Oct 23, 2003 1:43 pm
Posts: 10
Location: Calgary, Alberta Canada
Oh! Yes, it does work exactly. I had tried that but it hadn't worked so I looked to the subclass and joined-subclass mappings. But I must have just had something wrong because I just tried it again as you suggested and it worked just fine.

Thanks Gavin.


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.