| From: | Oliver Jowett <oliver(at)opencloud(dot)com> |
|---|---|
| To: | Martina <boehme(at)mpiib-berlin(dot)mpg(dot)de> |
| Cc: | pgsql-jdbc(at)postgresql(dot)org |
| Subject: | Re: Transaction foreign key violation |
| Date: | 2006-05-04 16:35:27 |
| Message-ID: | 445A2D4F.9070403@opencloud.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-jdbc |
Martina wrote:
>
> I'm getting a foreign key constraint violation if I run a transaction in
> which the first statement inserts a new row in Table1 (with serial as
> pk, "idTable1") and the second statement gets this "idTable1" as a fk.
> Because it is not there yet (but in the same transaction) I get this
> error. If I don't use transaction it is working.
> What can I do?
Can you show us your code, or (better) a small testcase that shows the
problem?
> I tried "SET
> TRANSACTION ISOLATION LEVEL SERIALIZABLE" (just with query.execute()
> before the other statements)) - no luck.
The right way to do this is via Connection.setTransactionIsolation().
-O
| From | Date | Subject | |
|---|---|---|---|
| Next Message | diego | 2006-05-05 12:13:00 | rowInserted, rowDeleted and rowUpdated |
| Previous Message | Dave Cramer | 2006-05-04 15:08:53 | Re: Bug with callable statement and output parameters |