I am using hibernate annotation . I have a child table which have a unique constrain of parent Id and code(child table).
Following mapping in child //bi-directional many-to-one association @ManyToOne @JoinColumn(name = "PARENT_ID") private ParentDO parentDO ;
mapping in parent DO // bi-directional many-to-one association to ChildDO @OneToMany(cascade=CascadeType.REMOVE) @JoinColumn(name = "PARENT_ID")
When delete only child with one transaction and then parents with different transaction it works.
If I delete both first child in a for loop and parent its giving
Hibernate: update CHILD_TABLE set PARENT_ID=null where PARENT_ID =? [WARN] SQL Error: 2290, SQLState: 23000 [ERROR] ORA-02290: check constraint (CHILD_PARENT_ID_CODE) violated
[WARN] SQL Error: 2290, SQLState: 23000 [ERROR] ORA-02290: check constraint (CHILD_PARENT_ID_CODE) violated
[ERROR] Could not synchronize database state with session
Do I need to change the mapping?
|