6

Using JPA i have a question relating to the CascadeTypes.

for Example:

@ManyToMany(fetch=FetchType.LAZY, cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH})

is different to this:

@ManyToMany(fetch=FetchType.LAZY, cascade={CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH})

Why? I need the cascadetype persist to automatically insert referenced objects in my entityclass. and i need merge because i dont want to have double entries in my tables. but when i define persist first, merging doesnt work, when i define merge first, persist doesnt work.

why?

4

1 に答える 1