Hi,
I was wondering if there is any way to ask Hibernate to assign the primary key to an object that is going to be created before the transaction commit. I'm creating an object in a transaction and need its id before commit, so that I can use it in the same transaction. I could flush the session but that would break my transaction, which would defeat the original purpose.
If this feature isn't supported yet, do you think it would be simple enough to implement it ? I figured that the id attribution could take place outside of the transaction as losing one or two increments in a sequence in case of rollback is usually not really important. What do you think ?
Thanks,
Matt.
|