This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
The only reliable way I can think of would be to use a sequence table that you query with a select for update at the start of the transaction, use the value in some other update/insert statements, then increment and update the value in the sequence table - all within the same transaction. It will be a performance nightmare, though, because of the exclusive lock.
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.