• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibernate reveng.xml customizing...

 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys :

Is there a way to customize a reveng.xml file to

1) use native as the preferred key generator class
2) to "cascade=All" for set properties ?

I cant find any good examples of such a reveng.xml file...
 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just bumping this one in case nobody saw it ? It seems like a question more than one person would have...
 
Adam Gresh
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure how you might do this in reveng.xml but you can easily do this with a "custom reveng strategy". If you're using Eclipse for the IDE with the hibernate plug-in go the the "run as..." dialog and under reveng.strateg enter something like com.mycom.util.MyRevEngStrategy.

As you might guess from the naming convention, this will be a java class. This will extend DelegatingReverseEngineeringStrategy and contains only a constructor that calls super(delegate) and the method...



...this overrides the default behavior for reveng so the next time you run reveng your generated hbm.xml will have native for the default generator type.

I found this on another forum, but can no longer locate that post :-/ Anyway, you may want to see...
http://www.hibernate.org/hib_docs/tools/reference/en/html/reverseengineering.html#custom-reveng-strategy

...for more info.

Hope this helps - maybe too late for you but might be of value to others.

Regards.
[ May 08, 2008: Message edited by: Adam Gresh ]
 
Adam Gresh
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Adam Gresh:


As you might guess from the naming convention, this will be a java class. This will estend DelegatingReverseEngineeringStrategy and contains only a constructor that calls super(delegate) and the method...




Just as an aside, the above is in reference to the first question asked...
1) use native as the preferred key generator class


The original code, quoted above, will make ALL identifiers native. Here is a corrected version...

...which has the effect of defaulting to assigned if nothing is configured in reveng.xml, but will use the value in reveng.xml if one was specified for the table. If you wanted native you would, of course, use that in the code instead of assigned.
[ May 08, 2008: Message edited by: Adam Gresh ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic