Understand:
The end of the inverse property is false, and has the right to manage relationship maintenance
The cascade attribute refers to cascading, that is, the popular point, the action specified at the end of the cascade, affects the associated object
As an example:
The relationship between class and student is one-to-many
Class class contains ID, name, and set set of students
Student Student class contains ID, name and class ID (foreign key)
Cascade attribute: The student is dependent on the class existence, the class does not exist, then the student also does not exist. In other words, when the class is deleted, the student will have to delete it, but not vice versa. When the end of the deletion, the more that the side has no meaning, and many of the end of the deletion, does not mean that the end of a meaningless. A bit around. Then the property setting is, class set "All", Student set "Save-update", so that the operation of class can affect the student, after the operation of student, save and update only affect class.
Inverse property: This property is a management and maintenance rights, in a one-to-many relationship, if the class has this right, then the class will manage to maintain the student collection, when the class is saved, it will update all students in the collection of foreign key attributes, this is not what we want, when the number of a lot, performance is not good. And if the right to the students, save the class, will not update the properties of the student collection, the foreign key can be manually set by ourselves. The popular point is that if the class chooses the student, then the student's class attribute will be modified, if the student chooses the class, the student's class attribute has been set up, the world is clean without the class to worry about.
These are my personal understanding, the online experience is:Inverse property is generally maintained by a multi-terminal, many-to-many situation to choose one end of maintenance, not both ends are maintained,Cascade property is generally set "all", multi-terminal settings "save-update ".
OK, the world is pure.
Hibernate Inverse properties and Cascade properties