This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Blog around the Campfire and the fly likes Simple Hibernate Cascade Save Example Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Other » Blog around the Campfire
Bookmark "Simple Hibernate Cascade Save Example" Watch "Simple Hibernate Cascade Save Example" New topic

Simple Hibernate Cascade Save Example

Christopher Rygaard
Ranch Hand

Joined: Feb 22, 2014
Posts: 42
Cascade Saving Example

This is the simplest way to illustrate cascade saving that I could cook up.

These persistent classes are nearly identical to those in the container example I posted earlier. The only difference is the annotation on Container._children.

The bit that illustrates the cascading saving is in HibernateExample.makeContents().

Notice: This is provided with no warranty whatsoever. Use at your own risk.

This is the contained class:

This is the container class:

This illustrates cascade saving:
I agree. Here's the link:
subject: Simple Hibernate Cascade Save Example
It's not a secret anymore!