Hey Ayende,

I had a peek at the mysql docs and it looks like they're the same -
I'm sure I read elsewhere they were different.

@@identity = "This variable is a synonym for the last_insert_id
variable. It exists for compatibility with other database systems. You
can read its value with SELECT @@identity, and set it using SET
identity. "

@@last_insert_id = "The value to be returned from LAST_INSERT_ID().
This is stored in the binary log when you use LAST_INSERT_ID() in a
statement that updates a table. "

It's probably best to give an example of what's happening as this is
in generated SQL - I managed to turn on the logging in NH and track
down the issue. Example below - i'm sorry if this kills the board.
Fairly simple Shopping cart scenario - Cart - Account - Order Items

Essentially what happens is;

Account1 Created
Order1 (and order items) Created for Account1

Account2 Created
Order2 (and order items) Created but the value for AccountId is
actually the Id of the last OrderItem inserted belonging to Order1

Log below, Check the comments against the second order insert;

Paul

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to