I've got a table xxx with id (id_xxx int AUTO_INCREMENT ) and title (title_xxx varchar (50)), After I place a brand new row within the table I made:
INSERT INTO xxx VALUES ("name for test");
and also the result (int=1) of insertion is came back, i quickly display during my java interface a note "succseed!", so far it is a very fundamental and straightforward operation... BUT, when I wish to return the placed id_xxx,I must do another query towards the database:
INSERT INTO xxx VALUES ("name for test"); //after the insert response I made: SELECT MAX (id_xxx) FROM xxx;
and that i display during my java interface "succseed $$$ is the id_xxx "....
the 2nd version can certainly result in a serious error throughout concurrent use of multiple customers: make a situation whenever a user1 bakes an place... after which H2DB interrupt procedures of the user then executes the place of user2. when user1 executes a choose max (id_xxx) the H2DB return An Incorrect id_xxx...
(Hopefully my example is obvious otherwise I'll schematize this issue).
how you can solve this issue?