Hibernate Save_update - cascade Type


#1

I am trying to map the cascadeType of an entity this way:

@OneToMany(mappedBy="pessoa",cascade = {CascadeType.DETACH,CascadeType.MERGE,CascadeType.PERSIST,CascadeType.REFRESH})

The problem, is that when i call the hibernate method saveorupdate(), hibernate is ignoring and not saving the child property. if I use CascadeType.ALL it works, but i dont want to include CascadeType.REMOVE;

Should I give up using the JPA annotations and use the hibernate specific SAVE_UPDATE?

How should I do the mapping, if it is the case?


#2

Use persist instead of the old saveOrUpdate and it will work.