Let me see if I have this straight.
Auto commit is off.
You're trying the following pseudo code...
Begin transaction
Insert into table 1
Get some return code from the insert for your foreign key for table 2
Insert into table 2
Commit Transaction
And this is failing?
> -----Original Message-----
> From: Mikael Sundberg [mailto:[email protected]]
> Sent: Thursday, February 19, 2009 7:08 AM
> To: Derby Discussion
> Subject: Foreign keys cuases deadlock?
>
> Hi I have the following problem.
>
> Im using autocommit off.
> I start by inserting into table1.
>
> I then want to insert into table2 that has a foreign key to table 1. (I
> use generatedkeys from my insert)
> This fails since it cant obtaing a lock on table1
> Is that expected?
> If I add a commit between the two statements it works.
>
> /Micke