-->
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.  [ 8 posts ] 
Author Message
 Post subject: Java Classes Generation
PostPosted: Thu Oct 02, 2003 7:07 pm 
Newbie

Joined: Thu Oct 02, 2003 6:37 pm
Posts: 3
Hi,

I would like to generate two classes from hibernate mapping files; an abstract class containing the mapped fields for a given table and a concrete class (inheriting from the abstract class) that can be modified by developers.

This generation scheme allows developers to modify concrete classes without losing the changes the next time the classes are generated; concrete classes are generated in temporary folder and only copied to the src folder if they are not already present.

Given the following table:

Labor
FirstName
LastName

I would like the following classes to be generated:

Class AbstractLabor


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 02, 2003 9:38 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
hbm2java can be told top generate the domain objects from hbm to allow exactly what you are describing. The Ant task can be used to automate this for the developers or as a nightly build task.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 03, 2003 12:30 pm 
Newbie

Joined: Thu Oct 02, 2003 6:37 pm
Posts: 3
Thanks for your reply.

I have not been able to find an example showing how to configure hbm2java to do this.

I've read the documentation and searched this forum and unfortunately nothing comes up.

Can you briefly explain how to configure this tool to achieve what I want?

Thank you very much for your time and help,
Chris


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 03, 2003 3:41 pm 
Beginner
Beginner

Joined: Thu Sep 25, 2003 5:22 pm
Posts: 29
Location: NC
Check here:
http://forum.hibernate.org/viewtopic.php?t=924447

-Kat


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 03, 2003 4:26 pm 
Newbie

Joined: Thu Oct 02, 2003 6:37 pm
Posts: 3
Thanks for your reply.

I don't think I explained myself in my previous post.

I know how to use Ant and the Hbm2JavaTask. My problem is with configuring this task to generate two classes (an abstract and a concrete one) as specified in my first post.

Any suggestions?

Thank you very much


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 03, 2003 11:37 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
By default hbm2java will only generate one class but will allow that generated class to have an extends in it so you can separate your domain logic so it does not get deleted when the classes are next generated. If you really want this functionality you can extend hbm2java with an additional renderer designed for your purpose.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 04, 2003 11:44 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
chrisizquierdo wrote:
Thanks for your reply.

I have not been able to find an example showing how to configure hbm2java to do this.

I've read the documentation and searched this forum and unfortunately nothing comes up.

Can you briefly explain how to configure this tool to achieve what I want?

Thank you very much for your time and help,
Chris


Read about the meta tag support in hbm2java in the docs.
Look for the "generated-class" attribute - it does exactly what you want ....hbm2java will generate the abstract class - and you make the concrete class....

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 04, 2003 11:45 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
sorry - you want to have the concerete class generated too....may I ask why ?

I normally only make an abstract class when I really want to have one...with hbm2jvav you could just tag the concrete classes you want to be abstract....

_________________
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.  [ 8 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.