Search Results

Search found 1 results on 1 pages for 'shvalb'.

Page 1/1 | 1 

  • OneToMany association updates instead of insert

    - by Shvalb
    I have an entity with one-to-many association to child entity. The child entity has 2 columns as PK and one of the column is FK to the parent table. mapping looks like this: @OneToMany(cascade = {CascadeType.ALL}, fetch = FetchType.EAGER ) @JoinColumn(name="USER_RESULT_SEQUENCES.USER_RESULT_ID", referencedColumnName="USER_RESULT_ID", unique=true, insertable=true, updatable=false) private List<UserResultSequence> sequences; I create an instance of parent and add children instances to list and then try to save it to DB. If child table is empty it inserts all children and it works perfectly. if the child table is not empty it updates existing rows! I don't know why it updates instead of inserts, any ideas why this might happen?? Thank you!

    Read the article

1