-->
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: ways to map a subclass within a subclass
PostPosted: Tue Sep 21, 2004 11:30 am 
Newbie

Joined: Tue Sep 21, 2004 10:46 am
Posts: 2
I have a general question and a specific one:

The general question is: I'm working with a class hierarchy: ClassA<--ClassB<--ClassC, for example, it can be a Person<--Employee<--Manager hierarchy. I wonder what is the best practice for mapping such a class hierarchy using Hibernate.

The specific question is: I've tried to map the class hierarchy using the table-per-class-hierarchy strategy, but I'd want to use a different discriminator for the ClassA<--ClassB branch than that for the ClassB<--ClassC branch. For Hibernate-2.1, it does not allow to specify a discriminator in the mapping of ClassB (such that the mapping of ClassC and its sibling classes can have a discriminator-value attribute): I got exception for doing this with the complain that the discriminator element need to be defined for the subclass element. I understand that Hibernate-3 offers more in o-r mapping options, so I downlowed Hibernate-3 from cvs and built it, then I removed the hibernate2.jar, replacing it with hibernate3.jar. Generating Java code and compile them were fine. But when I tried to generate the database schema, I got:
java.lang.NoClassDefFoundError: net/sf/hibernate/MappingException
at net.sf.hibernate.tool.hbm2java.Hbm2JavaTask.processFile(Hbm2JavaTask.java:145)

Can someones shine some lights on the subject? Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 21, 2004 6:40 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
You using the 2.x hbm2java which needs hibernate2.x . Hibernate 3.x uses new package hierarchy. You need to get the Hibernate 3.x version of hbm2java.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 22, 2004 2:08 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes - but please be aware that the hbm2java is not fully updated with all the H3 features yet! (so try it - and please report back what you might find missing ;)

_________________
Max
Don't forget to rate


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.