-->
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: Is a join-subclass + discriminator possible?
PostPosted: Wed Apr 05, 2006 6:14 pm 
Newbie

Joined: Wed Apr 05, 2006 5:58 pm
Posts: 13
I'm working with hibernate 3. I'll describe what I'd like to map.

I'll go with the old shape analogy.

I have a parent table shape. I have a child table circle. I'm using a join-subclass to model this part, and that seems fine. However, there are different types of circles, lets say there are red and yellow cirlces. At the end of the day, I would like to have an abstract Shape class, an abstract Cirlce class, and a RedCirlce and a YellowCircle class that will be the actual implementations.

Unless I'm mistaken, I can't add a discriminator attribute to the join-subclass, so I can't have hibernate handle the Red/Yellow stuff. Am I missing something? I can certainly just make the Circle class conrete and include a field indicating Red/Yellow, but I wanted to try it this other way.

Thanks,
Greg


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 05, 2006 10:12 pm 
Beginner
Beginner

Joined: Mon May 09, 2005 5:26 pm
Posts: 21
Hello Greg,

If I understand you correctly, I don't think you need a discriminator. Can't implicit polymorphism handle this for you?

http://www.hibernate.org/hib_docs/v3/reference/en/html/inheritance.html#inheritance-tableperconcreate-polymorphism

-don.


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.