jpa - orphan removal issue in hibernate 3.6.10 -


i facing issue orphan removal in hibernate.

problem: have entity a, has 1 one relation entity b. i've used 1 one annotation orphan removal attribute ( @onetoone(cascade = cascadetype.all, orphanremoval = true) ). associated entity b referenced other entities too. while deleting entity a, getting constraint violation exception saying 'child record found'. want delete associated entity deleted, if not referenced other entities. if has existing association, don't want delete b, deleted.

is there way this, using hibernate 3.6.10. read orphanremoval trick, didn't in case.

any appreciated..

thanks !

if same b, there can 1 or more as, annotation should like:

@entity public class {      @manytoone     private b b;  } 

there no orphanremoval available in case, different expect. map reverse:

@entity public class b {      @onetomany(mappedby="b", orphanremoval=true)     private list<a> alist;  } 

which means: when removed list, entire instance removed persistence.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -