Hi Friends,
I am getting error in my application.
I was developing my application with my local environment with Oracle XE local database and everything works perfectly fine there. But when I deploy application to Test environment I get the integrity constraint error.
Did any of you experience this error, can you suggest any solution. We have compared many times the database and both looks same.
And using the same script to create both database. Do not know, why we are getting this error only in Test Environment.
Quote:
Error - ORA-02291: integrity constraint (schmea.FKB673EFB6D0B27EE) violated - parent key not found
I have read most of the forums and threads and did not find any solution, I have tired all the options I can think of. Please help.
Files,
Parent class –
Code:
public class Batch extends BaseObject
{
public List<Action> actions;
@OneToMany(mappedBy = "batch", fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@JoinColumn(name="BATCH_KEY", nullable=false)
@OrderBy("timestamp DESC")
public List<Action> getActions()
{
if (actions == null)
{
actions = new ArrayList();
}
return actions;
}
}
Child class –
Code:
public class Action extends BaseObject
{
private Batch batch;
@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "BATCH_KEY", nullable = false)
public Batch getBatch()
{
return batch;
}
}
Java code to add child to parent table
Code:
public void addAction(Action action)
{
if (action == null)
{ // do nothing
return;
}
// tie the action to this batch
action.setBatch(this);
this.getActions().add(action);
}