-->
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: Multiple Inheritance Question
PostPosted: Sat Oct 25, 2003 7:21 pm 
Regular
Regular

Joined: Tue Sep 16, 2003 11:35 am
Posts: 93
Location: San Francisco, CA
Hey,

Obviously Java doesn't support multiple inheritance. However, using interfaces its possible to get into a situation in Hibernate that is somewhat similar, that is the data model seems to require multiple inheritance. Take for example:

Code:
interface Consumable
abstract class Liquid

class Pizza implements Consumable
class Wine extends Liquid implements Consumable
class Mercury extends Liquid


I need to be able to use Hibernate to query over Consumables and Liquids. Other classes need to have many-to-one relationships with a Consumable and/or Liquid.

So my questions are whether this setup is supported well by Hibernate and if so, how the table structure would be set up. I figure the database will not be able to have FKs to both Consumable and Liquid since this would come up against the multiple inheritance problem. But I'm not sure of that. I guess there are some complicated table schemas that would enforce unique ids over both types. However, Hibernate seems to require that a <subclass> only exist in one <class>.

Any thoughts, suggestions?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 25, 2003 7:24 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
However, Hibernate queries may reference classes and interfaces not mapped explicitly - and a Hibernate <any> mapping may be used to map a polymorphic association to an unmapped interface.


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.