-->
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.  [ 10 posts ] 
Author Message
 Post subject: how to control complex Pojo-generation ?
PostPosted: Tue Aug 23, 2005 4:03 am 
Senior
Senior

Joined: Mon Aug 22, 2005 5:45 am
Posts: 146
I need to generate not a simple Pojo, but a class hierarchy for each object.
(an abstract base class holding getter/setter and an empty subclass to implement custom logic)
I need to control that the base class is replaced on re-generation, but the subclass (the actual pojo) not.

How can I control this using eclipse plugin?
I see there is an option to pass the path for custom vm-templates.
However that's not sufficient for this scenario.
Can I pass some kind of generation strategy as mentioned in the ant-tools-docs ?

/m


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 23, 2005 6:04 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you can use a <meta attribute="generated-class">BaseXXX</meta> for the classes you want to subclass.

while writing this i just realized all the <meta> stuff is not documented anymore in H3...doh! You can find the meta tags in Hibernate2 docs.

Will add it to the H3 tools doc ASAP

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 24, 2005 10:59 am 
Senior
Senior

Joined: Mon Aug 22, 2005 5:45 am
Posts: 146
I see that the old hibernatetools did have a special attribute:

<codegen>
<generate prefix="Base" renderer="net.sf.hibernate.tool.hbm2java.BasicRenderer"/>
<generate renderer="net.sf.hibernate.tool.hbm2java.BasicRenderer">
<param name="generate-concrete-empty-classes">true</param>
<param name="baseclass-prefix">Base</param>
</generate>
</codegen>


Q: how do I construct this logic (base-class with empty subclass) in the new hibernatetools ?





max wrote:
you can use a <meta attribute="generated-class">BaseXXX</meta> for the classes you want to subclass.

while writing this i just realized all the <meta> stuff is not documented anymore in H3...doh! You can find the meta tags in Hibernate2 docs.

Will add it to the H3 tools doc ASAP


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 24, 2005 11:04 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the "generate a base class for all not just the marked ones" is not implemented yet

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 24, 2005 11:55 am 
Senior
Senior

Joined: Mon Aug 22, 2005 5:45 am
Posts: 146
that's really bad for us.

Please tell me, what else way is there now to build a Pojo-hierarchy with tool3?
What exactly do you mean with "marked ones"?

Is is possible to pass some kind of strategy-class that handles the logic?

As a total fallback: is it possible to use the old tool2 with hibernate3 ?

thx.


max wrote:
the "generate a base class for all not just the marked ones" is not implemented yet


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 24, 2005 12:00 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
put <meta attribute="generated-class">BasePerson</meta> in the Person class.

Then BasePerson will be generated and you provide the concrete Person that extends BasePerson

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 24, 2005 12:20 pm 
Senior
Senior

Joined: Mon Aug 22, 2005 5:45 am
Posts: 146
I need to generate the concrete Person class as well.

How do I specify that this class is generated as well?

max wrote:
put <meta attribute="generated-class">BasePerson</meta> in the Person class.

Then BasePerson will be generated and you provide the concrete Person that extends BasePerson


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 24, 2005 12:24 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
that is the part we dont have....why do you need it generated ?

if you dont need to extend/add to it just dont put the meta attribute there.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 25, 2005 4:43 am 
Senior
Senior

Joined: Mon Aug 22, 2005 5:45 am
Posts: 146
is there any list of which meta attributes are already supported in hibtools3 ?

max wrote:
put <meta attribute="generated-class">BasePerson</meta> in the Person class.

Then BasePerson will be generated and you provide the concrete Person that extends BasePerson


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 25, 2005 4:54 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
http://hibernate.org/276.html

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