java - Hiibernate: @OrderColumn in @OneToMany causes an UPDATE after INSERT -


i have following pojos db schema.

@entity @table(name = "quotes") public class quoterequest {     public quoterequest(){}      @id     @column(name = "quote_request_id")     @generatedvalue(strategy = generationtype.identity)     private long quoterequestid;       @onetomany(mappedby = "quoterequest", cascade = cascadetype.all)     @ordercolumn(name = "accidents_id")     private accidents[] accidents;      // getters , setters }  @entity @table(name = "accidents") public class accidents {     public accidents()     {     }      @id     @generatedvalue(strategy = generationtype.identity)     @column(name = "accidents_id")     private long accidentid;       @column(name = "amount", nullable = false)     private float amount;      @manytoone(optional = false, cascade = cascadetype.all)     @joincolumn(name = "quote_request_id", nullable = false)     private quoterequest quoterequest;      // getters , setters } 

because i'm using array store accidents[] hibernate requiring me add @ordercolumn. adding causes update generated after insert zeros out accidents_id. way found around change accidents[] set.

how can keep accidentsas array , not have hibernate force 2nd update after insert?


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -