permaculture playing cards
The moose likes JDBC and Relational Databases and the fly likes Transaction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Transaction" Watch "Transaction" New topic


Fernando Dominguez
Ranch Hand

Joined: Sep 01, 2006
Posts: 104

I have a question.

If I begin a transaction, (I am doing it with java, but I omit the code)

1 - I insert a value in a table

2 - now I try to insert a value in another table, I need the value I have Inserted before in table 1 because there is a referencial integrity.

3 I don't commit yet,
Here is my question.

I can't see the values of any data (in a data browser) until I commit them
Is the step 2 seeing the data inserted in 1, or Is step 2 going to complain about referencial integrity because It don't see any data until it is commited

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32614

Step 2 does see the update from step 1 because it is within the same transaction. It is other transactions that can't see the update from step 1.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: Transaction
It's not a secret anymore!