results in an error (613) when the transaction is commited:
[ObjectDB 2.2.4] javax.persistence.RollbackException
Failed to commit transaction: Attempt to reuse an existing primary key value (common.model.UserSession:13) (error 613)
at com.objectdb.jpa.EMImpl.commit(EMImpl.java:271)
at javax.jdo.Transaction$commit.call(Unknown Source)
I submit that there are a number of problems with this:
a) the error message is not helpful
b) it's thrown at commit(), which may be in a different part of the codebase from the persist()
c) it's not at all clear to me why this shouldn't be idempotent
ie: if there really is a convincing reason for this feature, then it might be helpful to: a) provide a better help message (ie: 'you called persist more than once on object xxxx'), and b) to throw the exception at the second persist, rather than waiting for commit.
Thoughts?