-->
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 with Interfaces and Superclass
PostPosted: Sun Jun 03, 2007 2:41 pm 
Newbie

Joined: Fri Feb 02, 2007 8:19 am
Posts: 5
Problem: Our Class-Hierarchy is somewhat complex.

We have a class Ad, AdBig and AdSmall, Article and an Interface calles PageElement. Ad ist the superclass of both AdBig and Small. Article and AdBig also impelement the Interface PageElement.

In yet another Class, we would like to have a Set of PageElements, which of course may contain both Articles as well as AdBigs...

Following the official Docs we would have to use Table-Per-Concrete-Class with implicit Inheritence, but a mapping Exception gets thrown.

Code:
Caused by: org.hibernate.MappingException: Could not determine type for: java.util.Set, for columns: [org.hibernate.mapping.Column(inhalt)]
   at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:266)
   at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
   at org.hibernate.mapping.Property.isValid(Property.java:185)
   at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:440)
   at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
   at org.hibernate.cfg.Configuration.validate(Configuration.java:1102)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1287)
   at de.nordakademie.schnak.util.HibernateUtil.<clinit>(HibernateUtil.java:13)
   ... 1 more


Mapping:

Code:
<class name="Ad"> ... simply mapping some properties ...</class>


Code:
<subclass name="AdBig/Small" extends="Ad">...</subclass>


Code:
<class name="Category">
   ...
   <set name="content">
      <key column="id"/>
      <one-to-many class="PageElement" />
   </set>
</class>


We also have other Classes who may hold instances to those Ads and Articles.. is there a way to implement this in Hibernate with hbm.xml-Files?

Thanks in advance
XriS


Top
 Profile  
 
 Post subject: Multiple Inheritance with Interfaces and Superclass
PostPosted: Sun Jun 03, 2007 6:55 pm 
Beginner
Beginner

Joined: Wed Apr 18, 2007 6:17 pm
Posts: 49
Location: Dominican Republic
hello, i assure you that it can be done, it would help if you post your complete hbm files as well, i'll appreciate that to help you.

Regards,


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.