-->
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: Abstract classes & hibernate
PostPosted: Wed Feb 23, 2005 11:29 pm 
Newbie

Joined: Wed Feb 23, 2005 9:41 am
Posts: 5
Location: Denmark
Hello,

I have a class hierarchy something like this:

* abstract main data class

* non-abstract class with businnes methods, extending the abstract main data class

I'm using xdoclet with @hibernate/<hibernatedoclet> to generate the mappings for hibernate. Those tags are only present in the main data-class, since subclass is dynamically generated (using <ejbdoclet>) and does not hold any persistent data.

So the .hbm.xml files have mappings for the main data class only.

Now, when trying to use hibernate to e.g. save() :
Code:
main_data_class data = (main_data_class)instanceOfDerivedClass;
session.save( data );
.. i get HibernateException: Unknown entity class: <Derived classname>.

My conclusion atm is that hibernate can only persist non-abstract classes, which actually would complicate my design a bit - is there a way around this ? Or am I doomed to make mappings for all generated classes/make a non-abstract data class ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 23, 2005 11:51 pm 
Newbie

Joined: Wed Feb 23, 2005 9:41 am
Posts: 5
Location: Denmark
In the heat of the moment i forgot to mention that I'm using the hibernate2 (newest production release).


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.