Understand:
The inverse property is the end of false. Have the right to manage relationship maintenance
The Cascade attribute refers to the Cascade, said popular point, on the cascade side of the specified operation. Affects the associated object
To give a sample example:
The relationship between class and student is one-to-many
Class class includes ID, name, and set set of students
Student student class includes ID. Name and class ID (foreign key)
Cascade attribute: The student is dependent on the class existence, the class does not exist. So the students don't exist either. In other words, the same time the class is deleted, the student will have to delete it, 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 Sets "All", Student Sets "Save-update", that is. The operation of class can affect student. Save and update after student operation affect class.
Inverse property: This property has administrative and maintenance rights. In a one-to-many relationship, assuming that the class has this right, the class will manage to maintain the student collection. When you save the class. It will update the foreign key attributes in all students ' collections, which is not what we want, when the number is very long and the performance is not good. If you give this right to the student, save the class. Will not update the properties in the student collection, this foreign key can be set manually by ourselves. Popular point is that. Class hypothesis to choose students. The students ' class attributes are changed, and the students ' class attributes are set in turn. Don't worry about the class. The world is pure.
All of these are my personal understanding. The experience on the Web is: theinverse property is usually maintained by a multi-terminal maintenance, many-to-many scenarios. Do not maintain both ends, theCascade property is usually one end set "All", multi-terminal set "save-update".
OK, the world is pure.
Hibernate Inverse properties and Cascade properties