I Found the solution, these are the available Cascades:
CascadeType.MERGE
CascadeType.PERSIST
CascadeType.DETACH
CascadeType.REMOVE
CascadeType.REFRESH
CascadeType.ALL
If you have an entity "USA" with a list of "States" Entites and you made changes to some states you just have to add:
@OneToMany(cascade = CascadeType.MERGE)
private State stateID;
And then just merge the USA Entity and not every changed state. With the CascadeType.MERGE
, it should automatically update everything for you.