- 
    Type:Improvement 
- 
    Resolution: Unresolved
- 
    Priority:Major - P3 
- 
    None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
Currently, executeUpdate does not handle duplicate key errors or other write errors returned in BulkWriteResult.writeErrors. As a result, users do not receive clear feedback (e.g., a ConstraintViolationException) when a unique constraint violation occurs - only a generic transaction aborted message from the server when Hibernate attempts to commit the transaction, because it did not know that the bulk write had errors.
What is currently thrown:
Caused by: com.mongodb.MongoCommandException: Command failed with error 251 (NoSuchTransaction): 'Transaction with { txnNumber: 2 } has been aborted 
Acceptance Criteria:
- Extract and handle relevant error codes from writeErrors in bulk write results, and propagate them via SQLException.
- Ensure SQLExceptionConversionDelegate maps MongoDB error codes to the appropriate Hibernate exceptions.
- Enable any disabled tests that depend on this exception handling logic.
- Investigate and implement any additional steps needed to handle these exceptions properly.
References:
Addressing the source code notes tagged with TODO-HIBERNATE-95 is in scope of this ticket.
- has to be done after
- 
                    HIBERNATE-40 Improve MongoStatement's #executeUpdate(String) implementation -         
- In Code Review
 
-