what difference between cascadetype options inserted inside @onetomany annotation , inserted inside @cascade? priority, 1 of 2 ignored?
@onetomany(mappedby="page", fetch=fetchtype.eager, cascade = {cascadetype.remove, cascadetype.persist}) @cascade({org.hibernate.annotations.cascadetype.save_update, org.hibernate.annotations.cascadetype.delete}) private list<tag> tags;
there no difference.
if onetomany jpa annotation (javax.persistence.onetomany) can not use hibernate 'cascade' inside. have use jpa cascade.
@cascade annotation specific hibernate , not jpa.
when write : cascadetype.save_update, mean cascade used when use hibernate method 'saveorupdate', when use hibernate methods save, delete, ... objects use @cascade annotation. if use jpa methods use cascade inside @onetomany annotation.
Comments
Post a Comment