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"