I'm experimenting with transaction management in spring boot and I got this error:
org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is java.sql.SQLException: READ_COMMITTED et SERIALIZABLE sont les seuls niveaux de transaction valides] with root cause
java.sql.SQLException: READ_COMMITTED et SERIALIZABLE sont les seuls niveaux de transaction valides
Translation:
READ_COMMITTED and SERIALIZABLE are the only valid transaction levels
Here are the steps to reproduce:
@Autowired
private PlatformTransactionManager transactionManager;
@Autowired
private EntityManager entityManager;
DefaultTransactionDefinition definition = new DefaultTransactionDefinition();
definition.setIsolationLevel(TransactionDefinition.ISOLATION_REPEATABLE_READ);
definition.setTimeout(3);
TransactionStatus status = transactionManager.getTransaction(definition);
try {
Payment payment = new Payment();
payment.setReferenceNumber("Ref-1");
payment.setState(Payment.State.SUCCESSFUL);
paymentJpaRepository.save(payment);
transactionManager.commit(status);
} catch (Exception ex) {
transactionManager.rollback(status);
}
Why can't I use repeatable read ? Also I didn't find any example mixing spring data repositories with PlatformTransactionManager, is this even legal ? (I didn't create any specific bean for PlatformTransactionManager and EntityManager, it's all default)
I tried with READ_COMMITED and it works correctly, I just want to understand why.
Jdbc url: jdbc:oracle:thin:@myHost:myPort/mySid Oracle version: 11g
Here is the documentation from Oracle themselves:
https://docs.oracle.com/cd/B28359_01/server.111/b28318/consist.htm#CNCPT1317
In 11g with the thin driver, they only support