-->
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: proper mapping strategy for subclasses
PostPosted: Thu Nov 16, 2006 12:30 pm 
Beginner
Beginner

Joined: Thu Apr 29, 2004 4:31 am
Posts: 42
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.1
Mapping documents:

HI all,
i am converting my existing EJB-based application to Hibernate, and i need some help with inheritance an dassociations

here's my situation.
I have followign classes

GenericRecord
-site
-date
-type

Record1 extends GenericRecord
- product
- empty
- location
- operator

Record2 extends GenericRecord
- cofc
- ticket
- product

Record3 extends GenericRecord

- location
- manualmode
- operator


I was going for the 'table per class' hierarchy, but was wondering if there was a better way to do that.
Fact is, i already have my discriminator on the GenericRecord (the type column)

anyone can help?

thanks in advance and regard
Marco


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 16, 2006 1:51 pm 
Regular
Regular

Joined: Tue Feb 24, 2004 11:42 am
Posts: 56
You can go for the discriminator which is good apart from the fact that it will not allow constraints like not null check.
If that is an issue for you then use
joined-subclass which is table per subclass. There is a tradeoff here as well as everytime it will query an extra table namely your generictable.
Hope this helps.
Please do rate


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.