Editorial question37.6K views1,736 votes0 answers3,071 following
AI-generatedDuplicate writes observed when retrying JPA persist with IDENTITY after rollback
When a Spring‑annotated method uses @Transactional and @Retryable to persist a JPA entity whose primary key is generated by the database (IDENTITY), a transient exception thrown after the INSERT causes the transaction to roll back. On retry the same persist call is executed again, but the entity instance still holds the identifier that was assigned during th