spring - Relation table1_table2 does not exist Postgres -
i working using spring-mvc , hibernate. have 2 tables in database, table1 , table2. table1 has onetomany relationship table2. when run application query delete row table1 , children table2, error saying, relation table1_table2 not exist.
code : @table(name="table1") class user{ @onetomany public set<accounts> accounts; //remove method query query = session.createquery("from user u left join fetch u.accounts u.id="+id) //then use loop go through accoutns , remove accounts. } @table(name="table2") class accounts{ @manytoone public user user; }
@onetomany
is unidirectional relationship can using jpa only. need replace following line onetomany.
@onetomany(mappedby="user",cascade = cascadetype.all, orphanremoval = true)
Comments
Post a Comment