-->
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.  [ 1 post ] 
Author Message
 Post subject: Persisting classes derived from mapping files
PostPosted: Tue Oct 05, 2004 3:17 pm 
Newbie

Joined: Tue Oct 05, 2004 3:00 pm
Posts: 5
I would like to use the tool to generate classes from mapping files and make this part of my build process. So if, for example, I add a new property to a class it will automatically become part of my compiled code. But in order to add methods to my generated classes I think I need to extend the persisted classes and add methods to the derived class. That way the generated class is not touched and can be replaced by the automated process.

Here is a class generated from a mapping file that will be persisted:

class Persisted
{
....
}

Here is my derived class which adds new methods, but no new properties:

class Derived extends Persisted
{
public void MyCustomMethod()
{
....
}
}

The question is, can I create objects of type Derived and have the Hibernate runtime persist it even though the mapping file has been written for the Persisted class? I can fake this by changing name of the class in the mapping file to the Derived class but I'm assuming there must be a proper way of doing it.

Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.