i going through spring project , in model classes there type
cascade={cascadetype.all}
written in parameters eg: ,
@manytoone(fetch = fetchtype.eager,cascade=cascadetype.all) @joincolumn(name="user_id", nullable=false)
private user user;
my question in purpose should use ?
thanky you.
this attribute means (because cascadetype.all) operations associated objects of class (outer class) executed associated object of class user (inner class).
for example:
@entity public class group { @manytoone(fetch = fetchtype.eager, cascade=cascadetype.all) @joincolumn(name="user_id", nullable=false) private user user`
if try remove group db cause removing of associated user.
enum cascadetype specify kind of operations want perform associated user.
if want specify cascading execution removing , persist have that:
@manytoone(cascade = {cascadetype.remove, cascadetype.persist}, fetch = fetchtype.eager)
Comments
Post a Comment