Search code examples
databasehibernatereverse-engineeringcascadehibernate-tools

Hibernate reverse engineering cascade


I'm using the Hibernate Reverse Engineering to generate annotated entities and a cfg.xml for a very large non static set of database tables. Is it possible to tell the reverse engineering tool to set cascade all for all oneToOne and oneToMany associations.

I know this is a bit voodoo to automatically set CascadeType, but if it can be done safely, it would save make things very smooth in keeping two systems running during a gradual migration.


Solution

  • There isn't a cure all for this one, but the rev eng file lets you specify cascade for particular properties(while letting other attributes be generated), which is probably the safest option.