java - Hibernate Master Details Relation Table Delete Error -


my spring hibernate project having 2 tables listnote & listnotedetails. mapping given below.the data insertion , getting tables worked fine. when execute delete master data throw exception.

    @entity     @table(name = "list_note")     public class listnote implements serializable {          @id         @generatedvalue(strategy = generationtype.auto)         @column(name = "id", nullable = false, length = 11)         private long id;         @column(name = "title", nullable = false)         private string title;         @manytoone         @joincolumn(name = "folder_id")         private folder folder;         @column(name = "created_date", nullable = false)         private date createddate;          @onetomany(fetch = fetchtype.eager, orphanremoval = true, cascade =     cascadetype.all)         @fetch(value = fetchmode.subselect)         @joincolumn(name = "list_note_id")         private list<listnotedetails>details=new arraylist<listnotedetails>(); //getters  & setters.      }    @entity @table(name = "list_note_details") public class listnotedetails implements serializable {      @id     @generatedvalue(strategy = generationtype.auto)     @column(name = "id", nullable = false, length = 11)     private long id;     @column(name = "point", nullable = false)     private string point;     @manytoone     @joincolumn(name = "list_note_id")     private listnote listnote; //getters , setters } 

when delete listnote master data using primary key having following error.

14:10:15,651 warn  [org.hibernate.engine.jdbc.spi.sqlexceptionhelper] (http--0.0 .0.0-8080-1) sql error: 1048, sqlstate: 23000 14:10:15,655 error [org.hibernate.engine.jdbc.spi.sqlexceptionhelper] (http--0.0 .0.0-8080-1) column 'list_note_id' cannot null 14:10:15,655 info  [org.hibernate.engine.jdbc.internal.logicalconnectionimpl] (h ttp--0.0.0.0-8080-1) hhh000106: forcing container resource cleanup on transactio n completion 14:10:15,659 info  [org.hibernate.engine.jdbc.batch.internal.abstractbatchimpl] (http--0.0.0.0-8080-1) hhh000010: on release of batch still contained jdbc st atements 14:10:15,659 info  [stdout] (http--0.0.0.0-8080-1) column 'list_note_id' cannot null; sql [n/a]; constraint [null]; nested exception org.hibernate.excepti on.constraintviolationexception: column 'list_note_id' cannot null 


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -