hibernate - Unnecessary delete on @ManyToMany relationship -
i have 2 entities:
@entity public class entity1 { @id @column(name="id_entity_1") private integer id; @onetomany(mappedby="entity1", cascade={cascadetype.persist}) private list<entity2> list; @manytomany @jointable( schema="schema", name="v_other_relationship", joincolumns={@joincolumn(name="id_entity_1", insertable=false, updatable=false)}, inversejoincolumns={ @joincolumn( name="id_entity_2", referencedcolumnname="id_entity_2", insertable=false, updatable=false ) } ) //getters , setters } @entity public class entity2 { @id @column(name="id_entity_2") private integer id; @manytoone @joincolumn(name="id_entity_1) private entity1 entity1; //getters e setters. }
note not exists cascade in @manytomany relationship through v_other_relationship.
but, when execute 1 delete on entity1, first thing occurres 1 delete in v_other_relationship causes error because readonly.
help-me.
Comments
Post a Comment