I have a database and I generated all bean and hbm.xml files with hibernate tool.
I noticed this tool not generated automatically the cascade property... I read it can be done using reveng.xml.
There are ways to auto-generate revenge.xml, or set a cascade property 1 time for all tables?
There are multiple options for the auto property:
create
- It creates new tables corresponding mapping or annotation. It drops existing tables and data.update
- It keeps existing data and tables. It updates the schema.
here we have to take care contracts.create-drop
- It is same like create but once session gets closed it
drops everything.validate
- it validates or matches schema with map or annotation.
It's valid for a Production environment.Propery hbm2ddl.auto = update
in configuration xml.
If you want to delete cascade you should add to your collection in XML the following:
cascade="delete-orphan"
cascade="save-update, delete"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With