java - Remove fields in embeddable (JPA) -


i'm trying remove list in embeddable removing embeddable entity. isn't working.. entities in list still in de database.

code:

method starts:

 //attached entity  ship ship = findship();  ship.removeitinerary(); 

ship:

@entity @table(name = "ship") public class ship extends domain {     @embedded    private itinerary itinerary;      public void removeitinerary() {       this.itinerary = null;    }     

}

itinerary:

@embeddable public class itinerary implements serializable {     //tried orphanremoval , cascade without luck     //(since i'm not removing ship it's logic it's not working..)    @onetomany    @joincolumn(name = "ship_id", referencedcolumnname = "id")    private list<stop> stops = new arraylist<>(); 

}

jpa 2.0

if itinerary saved database, need delete it. eg, like

public void removeitinerary() {    getentitymanager().remove(this.itinerary);    this.itinerary = null; } 

Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -