From hibernate-commits at lists.jboss.org Thu Mar 15 13:33:40 2007 Content-Type: multipart/mixed; boundary="===============3080377566130612720==" MIME-Version: 1.0 From: hibernate-commits at lists.jboss.org To: hibernate-commits at lists.jboss.org Subject: [hibernate-commits] Hibernate SVN: r11289 - trunk/HibernateExt/annotations/doc/reference/en/modules. Date: Thu, 15 Mar 2007 13:33:40 -0400 Message-ID: --===============3080377566130612720== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: epbernard Date: 2007-03-15 13:33:39 -0400 (Thu, 15 Mar 2007) New Revision: 11289 Modified: trunk/HibernateExt/annotations/doc/reference/en/modules/entity.xml Log: ANN-574 more precise doc for cascading Modified: trunk/HibernateExt/annotations/doc/reference/en/modules/entity.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/HibernateExt/annotations/doc/reference/en/modules/entity.xml 2007= -03-15 11:38:45 UTC (rev 11288) +++ trunk/HibernateExt/annotations/doc/reference/en/modules/entity.xml 2007= -03-15 17:33:39 UTC (rev 11289) @@ -1669,7 +1669,7 @@ = - + Transitive persistence with cascading = You probably have noticed the cascade @@ -1700,6 +1700,12 @@ = + + CascadeType.ALL also covers Hibernate specific operations = like + save-update, lock etc... Check for more information + + Please refer to the chapter 6.3 of the EJB3 specification for more information on cascading and create/merge semantics. @@ -2933,8 +2939,7 @@ a custom collection persister (ie the persistence stra= tegy used) using @Persister: the class must implement - org.hibernate.persister.collectionCollectionPersi= ster - + org.hibernate.persister.collectionCollectionPersi= ster = @@ -3269,10 +3274,81 @@ = + + Cascade + + Hibernate offers more operations than the Java Persistence + specification. You can use the @Cascade annotatio= n to + cascade the following operations: + + + + PERSIST + + + + MERGE + + + + REMOVE + + + + REFRESH + + + + DELETE + + + + SAVE_UPDATE + + + + REPLICATE + + + + DELETE_ORPHAN + + + + LOCK + + + + EVICT + + + + This is especially useful for SAVE_UPDATE + (which is the operation cascaded at flush time if you use plain + Hibernate Annotations - Hibernate EntityManager cascade + PERSIST at flush time as per the specification). + DELETE_ORPHAN applies only to @OneToMany + associations, and indicates that the + delete()/remove() operation should be appli= ed + to any child object that is removed from the association. In other + words, if a child is dereferenced by a persistent parent and if + DELETE_ORPHAN is used, the "orphaned" child is + deleted. + + @OneToMany( cascade =3D {CascadeType.PERSIST, Cascad= eType.MERGE} ) +(a)Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, + org.hibernate.annotations.CascadeType.DELETE_ORPHAN}) +public Collection<Employer> getEmployers() + + It is recommended to use @Cascade to compliment @*To*(cascade= =3D...) + as shown in the previous example. + + Cache = - In order to optimize your database accesses, you can activave = the + In order to optimize your database accesses, you can activate = the so called second level cache of Hibernate. This cache is configurabl= e on a per entity and per collection basis. = --===============3080377566130612720==--