-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: delete parent and child throwing ORA-02290: check constrain
PostPosted: Fri Oct 23, 2009 10:35 am 
Newbie

Joined: Fri Oct 23, 2009 10:23 am
Posts: 1
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?


Top
 Profile  
 
 Post subject: Re: delete parent and child throwing ORA-02290: check constrain
PostPosted: Mon Oct 26, 2009 10:32 am 
Beginner
Beginner

Joined: Mon Sep 14, 2009 9:29 am
Posts: 30
set cascade="delete-orphan" in .hbm file or try update="false" insert="false"..this will not affect parent table


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.