@NotFound (Action=notfoundaction.ignore)
Using Hibernate
Annotations Configure the association of entity classes, in the Many-to-one,one-to-one Association, while referencing attributes from the other side, and hibernate throws an exception by default if the property value of XXX does not exist in the database. To solve this problem, add the following annotations: @NotFound (action=notfoundaction.ignore), meaning that the referenced foreign key data is not found, NotFound default is exception
-------------------------------------------------------------------
cascade = Cascadetype.refresh,cascade=cascadetype.all
Cascade representing cascading operations
Cascadetype.merge Cascade Update: If the Items property is modified then the order object is saved and the objects in items are modified at the same time. The merge method corresponding to Entitymanager
Cascadetype.persist Cascade Refresh: Gets the object in the order object that also retrieves the latest items at the same time. The Refresh (object) method corresponding to the Entitymanager is valid. will re-query the latest data in the database
Cascadetype.refresh: The objects in items are also saved when the order object is saved. The Presist method of corresponding Entitymanager
Cascadetype.remove Cascade Delete: Delete the Order object as well as the objects in items. Remove method corresponding to Entitymanager
Cascadetype.persist a cascade B object is added when only Class A is added. If the B object is in the data inventory (followed by the new) then throw an exception (let B become persistent state)
Cascadetype.merge refers to a class of new or changed, cascading B objects (new or changed)
Cascadetype.remove only Class A delete, cascade delete Class B;
Cascadetype.all contains all;
Cascadetype.refresh didn't work.
In general: Most of the cases with Cascadetype.merge can achieve cascade with new and not error, use Cascadetype.all to consider Cascadetype.remove
@Fetch:
Defines the fetch policy that loads the associated relationship. Fetchmode can be
Select (Triggers a SELECT operation when an association is required), Subselect (valid for collection only, subquery policy is used, details refer to Hibernate reference document)
Join (Use SQL join to load the association relationship when loading the primary entity).
Join will overwrite any deferred attributes (the associations loaded through the join policy will no longer be deferred).
Reprinted from: http://www.blogjava.net/stone840/archive/2013/03/05/396062.html
JPA Knowledge points