java - Saving "master" element in many to one relationship with ebean -


I have been a bit of an issue with EBI (in the context of the Play Framework, Java). I have elements sharing one-to-one relationship (bank account & lt; - banking operation).

I have defined the bank account class with others, with the following fields:

  @JsonIgnore @OneToMany (CASADCAD = CASCADE type.AL) Public list & amp; ; Banking operation & gt; Operating = new array list & lt; Banking operation & gt; ();   

For banking operations, this field:

  @ManyToOne @JsonIgnore public bank account bank account;   

My point is that when I try to update the bank account, it removes the related tasks I am using this code:

  Public Stable Result Savings Account (Long ID) {Form & lt; Bank account & gt; Form = form. Form (bank account category) .bindformuarest (); If (form.hasErrors () || form.get (). Id! = Id) {return badRequest (); } form.get () Update (id); OK (); }   

I think the operations are removed because they are not loaded while forming (). get (), and thus, while synchronizing with DB, EBN does what seems to be the best solution to do this.

Does anyone have any clue on this issue? Is there another solution that I have not searched yet?

Thank you in advance for your help!

For now, I've got an (ugly) solution that was adding the following line before updating Is:

  Ebean.refreshMany (form.get (), "operation");   

Another solution could be to create a model class, but not to another class, forcing me to map each field one by one.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -