java - How to cascade the update of @Version when you update its children? -


problem:

i have parent class @version on attribute "lastupdate" concurrency checking. parent class has @onetomany relationship , when update children update field "lastupdate" such happens when update other fields.

in jpa there @optmisticlocking(cascade = true) operation, couldn't find similar option ebean orm in play2.

important: there no cascadetype between classes.

code:

@entity public class child extends model {   @manytoone()   @joincolumn(name="parent_id")   public parent parent; }   @entity public class parent extends model {   @version   public date lastupdate;    @onetomany(mappedby = "parent")   public list<child> children = new arraylist<child>(); }   public class application extends controller {   public void updatechild(parent p, child c) {     ...     c.save(); // or c.update()     p.children.set(c); // imagine real code here updating, adding or removing child.      p.update();     return;   } } 

you can find similar question here: version of parent object not incremented if one-to-many relationship of parent object modified

thanks lot... =)

logged https://github.com/ebean-orm/avaje-ebeanorm/issues/155

will supported in 4.1.1 markasdirty() method.

p.markasdirty(); p.update(); 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -