3.2.5.4. Transitive persistence with cascading


You probably have noticed the cascade attribute taking an array of CascadeType as a value. The cascade concept in EJB3 is very is similar to the transitive persistence and cascading of operations in Hibernate, but with slightly different semantics and cascading types:
  • CascadeType.PERSIST: cascades the persist (create) operation to associated entities persist() is called or if the entity is managed
  • CascadeType.MERGE: cascades the merge operation to associated entities if merge() is called or if the entity is managed
  • CascadeType.REMOVE: cascades the remove operation to associated entities if delete() is called
  • CascadeType.REFRESH: cascades the refresh operation to associated entities if refresh() is called
  • CascadeType.ALL: all of the above

Note

CascadeType.ALL also covers Hibernate specific operations like save-update, lock etc... Check Section 3.4.7, “Cascade” for more information
Please refer to the chapter 6.3 of the EJB3 specification for more information on cascading and create/merge semantics.
Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat