Manage Transactions, Validation, and Exceptions

The transaction contract depends on the backing technology. Distinguish deployment errors from invocation failures.

Apply Transaction Boundaries

Jakarta Persistence-backed operations participate in an existing Jakarta Transactions (JTA) transaction. When an operation requires a transaction and none exists, WebLogic Server establishes and completes one.

Keep an application transaction around related JPA operations when they must share a boundary. A repository default method alone does not define that boundary.

NoSQL-backed repository operations do not participate in JTA global transactions. Applications must use the documented Oracle NoSQL operation and consistency guarantees.

Handle Validation and Repository Failures

Method parameters and return values participate in Bean Validation where required. Invocation-time constraint violations use the validation contract. Invalid repository and entity definitions fail deployment.

WebLogic Server maps jakarta.persistence.NonUniqueResultException to jakarta.data.exceptions.NonUniqueResultException and jakarta.persistence.OptimisticLockException to OptimisticLockingFailureException. Applicable wrapped ConstraintViolationException causes are preserved.

Handle each failure according to its contract. Mapping errors, authorization denial, provider construction failure, and optimistic-locking failure require different responses.