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: Hibernate-Tools ReverseEngineeringStrategy or reveng.xml
PostPosted: Tue Sep 12, 2006 2:39 am 
Newbie

Joined: Mon Sep 11, 2006 10:40 am
Posts: 3
Hello,

I would like to customize the settings of the hibernate-tools, thus I think of using the reveng.xml or an own class, that inherits of DelegatingReverseEngineeringStrategy.class. The aim is to

1. use increment as generator,
2. use int for the id's (not Integer) and
3. use equals() and hash() function
automatically for all entities.

My concrete problems:
- for 3.: <meta attribute="use-in-equals">true</meta> in XXX.hbm.xml has no effect when using the reveng.xml. Why?
- The hibernate.jar does not contain the DelegatingReverseEngineeringStrategy-class. Where can I get it?

Thank you


Top
 Profile  
 
 Post subject: Re: Hibernate-Tools ReverseEngineeringStrategy or reveng.xml
PostPosted: Tue Sep 12, 2006 3:14 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
herminator wrote:
1. use increment as generator,


besides "increment" being the *worst* id generator to choose then if you want it for *all* keys then the reveng class is the best option.

Quote:
2. use int for the id's (not Integer) and


depends on your db, but two choices:

1) implement columnToHibernateTypeName to return java.lang.Integer for the relevant columns

2) use a type-mapping that redefines it for all classes of integer columns you are using

Quote:
3. use equals() and hash() function
automatically for all entities.


You do know this is dangerous, right ? :)

in any case, only currently possible by putting <meta> into the templates.

Quote:
- for 3.: <meta attribute="use-in-equals">true</meta> in XXX.hbm.xml has no effect when using the reveng.xml. Why?


huh? hbm.xml is not read then using reverse engineering so how should they have effect ? the hbm.xml is just generated.

If you want to generate pojo based on the generated hbm.xml's then do it in 2 steps.

Quote:
- The hibernate.jar does not contain the DelegatingReverseEngineeringStrategy-class. Where can I get it?


its in hibernate-tools.jar, see docs for where it is.

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