"Knowing is not enough, you must apply... Willing is not enough, you must do."
--Bruce Lee
[OCP 21 book] | [OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Todd Jain wrote:Currently, I'm using a second select statement (something like: select max(pk) from table_name) to get the primary key just created.
"Knowing is not enough, you must apply... Willing is not enough, you must do."
--Bruce Lee
"Knowing is not enough, you must apply... Willing is not enough, you must do."
--Bruce Lee
Phil Freihofner wrote:Couldn't there also be concurrency issues with the SELECT Max(pk) form? Suppose another user creates a record in between the time when the first record is inserted and the second SQL select is issued?
I'd stick with the "official" MySQL format unless there was a very good reason not to.
"Knowing is not enough, you must apply... Willing is not enough, you must do."
--Bruce Lee
Tejas Jain wrote:
Phil Freihofner wrote:Couldn't there also be concurrency issues with the SELECT Max(pk) form? Suppose another user creates a record in between the time when the first record is inserted and the second SQL select is issued?
I'd stick with the "official" MySQL format unless there was a very good reason not to.
This should not be a problem if I set isolation level setting as SERIALIZABLE.
Don't get me started about those stupid light bulbs. |