-->
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: Problem saving when upcasting to interface
PostPosted: Fri Jul 29, 2005 10:44 am 
Beginner
Beginner

Joined: Sun Jun 05, 2005 9:45 am
Posts: 27
I had a three classes (UserTypeA, UserTypeB, UserTypeC) that extended a User class and everything worked.

I was recently refactoring the code and created a "User" interface based on the old User class and converted the old User class to AbstractUser which now implements the "User" interface. UserTypeA, UserTypeB, UserTypeC now extend this class. My xdoclet hibernate mappings are in the AbstractUser class.

I can no longer save my classes when upcasting to the User interface because hibernate does not know about it. To make this work, do I have to move my xDoclet mappings into the "User" interface?


Regards,

Joshua


Top
 Profile  
 
 Post subject: Status
PostPosted: Fri Jul 29, 2005 2:57 pm 
Beginner
Beginner

Joined: Sun Jun 05, 2005 9:45 am
Posts: 27
Ok,

I found this tid bit in the hibernate docs:

Quote:
It is perfectly acceptable for the named persistent class to be an interface. You would then declare implementing
classes of that interface using the <subclass> element.


So, I moved my xdoclet tags to the "User" interface. I tried putting a
"subclass" tag in my AbstractUser class, but it is not getting picked up. I would expect to see xDoclet throw the subclass mappings in the User.hbm.xml file. No Dice.

Any suggestions?

Joshua


Top
 Profile  
 
 Post subject: Re: Status
PostPosted: Fri Jul 29, 2005 4:13 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
gigabee wrote:
Ok,

I found this tid bit in the hibernate docs:

Quote:
It is perfectly acceptable for the named persistent class to be an interface. You would then declare implementing
classes of that interface using the <subclass> element.


So, I moved my xdoclet tags to the "User" interface. I tried putting a
"subclass" tag in my AbstractUser class, but it is not getting picked up. I would expect to see xDoclet throw the subclass mappings in the User.hbm.xml file. No Dice.

Any suggestions?

Joshua


It doesn't matter what file they are in.
All that matters is that they are defined correctly.

You can place your <subclass> mappings in the same *.hbm.xml file or in separate files as the parent <class> mapping.

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


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.