I am developing a web-app using H2 Server, Spring, and iBatis.

I have all my tables setup with   int AUTO_INCREMENT PRIMARY KEY

and in some cases my transactions involve inserting linked records in
different tables and i want to be able to setup iBatis's sqlmap insert
statements.
E.G i want to begin a transaction, get the NEXTVAL( ) key for the
table of the audit
text messages, insert the msg record into the audit message table
and then insert the audit record into the Audit Table with the FK of
the message
record in the audit record.  Most of my audit records don't need a
audit msg
record.

Why is there not some "alias" for the H2 generated sequence that is
created
for an AUTO_INCREMENT PK column, that i can use in NEXTVAL()?

E.G  why can't i use something like
NEXTVAL('AUTO_INCREMENT.TABLENAME')
or some other syntax that would reference the proper sequence for that
table.

I also was a bit puzzled when i noticed that when i do a
SELECT IDENTITY() FROM AUDITMSG;
i get back a result set that has as many records, all with the same
IDENTITY() value,
as the AUDITMSG table currently contains, and as the table grows, so
does the
result set?  Is this what that select is supposed to do? i was
expecting one row;

The multiple rows causes a iBatis to try to return a List in place of
an Integer object.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "H2 
Database" 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/h2-database?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to