Hibernate In Action

xiaoxiao2021-03-05  24

Inverse = "true" in One to Many means this is a two-way association. You need to declare the Many to One on the other side.

You can map entity associations in metadata with the following attributes: ■ cascade = "none", the default, tells Hibernate to ignore the association ■ cascade = "save-update" tells Hibernate to navigate the association when thetransaction is committed and when an. object is passed to save () orupdate () and save newly instantiated transient instances and persist changes todetached instances. ■ cascade = "delete" tells Hibernate to navigate the association and delete persistentinstances when an object is passed to delete (). ■ cascade = "all" means to cascade both save-update and delete, as well ascalls to evict and lock. ■ cascade = "all-delete-orphan" means the same as cascade = "all" but, in addition, Hibernate deletes any persistent entity instance that has been removed (dereferenced) from the association (for example, from a collection). ■ cascade = "delete-orphan" Hibernate will delete any persistent entityinstance that has been removed (dereferenced) from the association (forexample, from a collection ).

转载请注明原文地址:https://www.9cbs.com/read-33119.html

New Post(0)