• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

hibernate reveng.xml customizing...

 
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic