Java SQL (h2): What's the best way to retrieve the unique ID of the single item I just inserted into
- by Daddy Warbox
My current method is this:
SELECT TOP 1 ID FROM DATAENTRY ORDER BY ID DESC
This assumes the latest inserted item always has the highest unique ID (primary key, autoincrementing). Something smells wrong here.
Alternatives?