У меня проблема с поддержкой транзакций в моем приложении Spring Boot. Я получил и исключение, если функция dodajRezerwacje (), но записи в базе данных изменены.
Я проверил все сервисы, и у них есть аннотация @Transactional. Я добавил "springframework.transaction = DEBUG" в application.properties, чтобы найти проблему, но не сделал этого.
App.java:
@SpringBootApplication
@EnableJpaRepositories(basePackages = "ekoncept.dao")
@ComponentScan(value = "ekoncept.*")
@EntityScan("ekoncept.model.entity")
@EnableScheduling
public class App
{
public static void main( String[] args ) {
SpringApplication.run(App.class, args);
}
}
EntityManagerFactoriesConfig.java:
@Configuration
public class EntityManagerFactoriesConfig {
@Autowired
private DataSource dataSource;
@Bean(name = "entityManagerFactory")
public LocalContainerEntityManagerFactoryBean emf() {
LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
emf.setDataSource(dataSource);
emf.setPackagesToScan(
new String[]{"ekoncept"}); // czy cały pakiet?? nie wiem...
emf.setJpaVendorAdapter(
new HibernateJpaVendorAdapter());
return emf;
}
}
TransactionManagersConfig.java:
@EnableTransactionManagement
public class TransactionManagersConfig {
@Autowired
EntityManagerFactory emf;
@Autowired
private DataSource dataSource;
@Bean(name = "transactionManager")
public PlatformTransactionManager transactionManager() {
JpaTransactionManager tm =
new JpaTransactionManager();
tm.setEntityManagerFactory(emf);
tm.setDataSource(dataSource);
return tm;
}
}
RezerwacjaManager.java:
@Service
@Transactional
public class RezerwacjaManager {
...
public boolean edytujRezerwacje(String input, AuthUser user)
throws IOException, RecordIdNotFoundException, ParamValueNotValidException, ParseException, RecordIdNotAllowedException,
RecordNotExistsException, MethodParamMissingException, RequiredFieldNotFoundException,
CCardNotModificableException, OnlinePaymentErrorException {
logMgr.logJsonInput("edytujRezerwacje", input);
Rezerwacja rez = (Rezerwacja) rezFact.getUpdatedObject(input);
org.json.JSONObject jsonObj = new org.json.JSONObject(input);
if (jsonObj.has("CCard")) { // THIS OPERATIONS ARE SAVED IN DB (insert into table CCard + delete from tabele Ccard + update table Rezerwacja)
Ccard oldCC = null;
if (rez.getCcardId() != null) { // karta została już wprowadzona
oldCC = ccardDao.findOne(rez.getCcardId());
if (oldCC != null && oldCC.getCcardVerified() == 1) {
throw new CCardNotModificableException("karta została zweryfikowana");
}
}
String ccNumer = "";
org.json.JSONObject ccObj = jsonObj.getJSONObject("CCard");
Ccard cc = (Ccard) ccardFact.getNewObject(ccObj.toString());
ccardDao.save(cc);
histMgr.logToHistoryCCard(cc.getCcardId(), rez.getRezerwacjaId(), null, user, Operacja.NOWY_REKORD);
if (oldCC != null) { // usunięcie starych danych
histMgr.logToHistoryCCard(oldCC.getCcardId(), rez.getRezerwacjaId(), null, user, Operacja.USUNIECIE_DANYCH);
ccardDao.delete(oldCC);
}
rez.setCcardId(cc.getCcardId());
}
if (jsonObj.has("Platonline")) { // NOT EXECUTING IN THIS CASE
....
}
rezDao.save(rez); // THIS OPERATIONS ARE SAVED IN DB (update table Rezerwacja)
histMgr.logToHistory(rez, user, Operacja.MODYFIKACJA_DANYCH); // THIS OPERATIONS ARE SAVED IN DB (insert into table Historiaop)
if (jsonObj.has("Rezerwacjaosoba")) {
....
}
if (jsonObj.has("Usluga")) {
.... // !!! HERE I GOT AN EXCEPTION !!!
}
return true;
}
...
}
Мой DEBUG.log:
2019-01-09 12:54:48 - Bound request context to thread: org.apache.catalina.connector.RequestFacade@4869f607
2019-01-09 12:54:48 - Opening JPA EntityManager in OpenEntityManagerInViewInterceptor
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=0} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Creating new transaction with name [ekoncept.service.RezerwacjaManager.edytujRezerwacje]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
2019-01-09 12:54:48 - Exposing JPA transaction as JDBC transaction [org.springframework.orm.jpa.vendor.HibernateJpaDialect$HibernateConnectionHandle@3896d31d]
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=0} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=0} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - select ... from Rezerwacja rezerwacja0_ where rezerwacja0_.REZERWACJA_ID=?
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=0} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - select ... from Pokoj pokoj0_ where pokoj0_.POKOJ_ID=?
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=0} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - select ... from Pokojtyp pokojtyp0_ where pokojtyp0_.POKOJTYP_ID=?
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=0} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - select ... from Asort asort0_ where asort0_.ASORT_ID=?
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=0} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - select ... from OSOBA osoba0_ where osoba0_.OSOBA_ID=?
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=0} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=0} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - select ... from Usluga usluga0_ where usluga0_.USLUGA_DOMYSLNA=-1 and (usluga0_.REZERWACJA_ID=? or ? is null) and (usluga0_.MELDUNEK_ID=? or ? is null)
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[EntityKey[ekoncept.model.entity.Rezerwacja#81997], EntityKey[ekoncept.model.entity.Pokoj#-3], EntityKey[ekoncept.model.entity.Pokojtyp#3], EntityKey[ekoncept.model.entity.Osoba#35054], EntityKey[ekoncept.model.entity.Asort#24]],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=0} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - select ... from Ccard ccard0_ where ccard0_.CCARD_ID=?
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=0} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=0} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=0} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - select gen_id( SEQ_CCARD, 1 ) from RDB$DATABASE
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=1} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=1} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=1} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=1} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - select gen_id( SEQ_HISTORIAOP, 1 ) from RDB$DATABASE
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=2} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=2} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=2} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=2} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - select gen_id( SEQ_HISTORIAOP, 1 ) from RDB$DATABASE
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=3} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=3} updates=ExecutableList{size=0} deletions=ExecutableList{size=1} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=3} updates=ExecutableList{size=0} deletions=ExecutableList{size=1} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=3} updates=ExecutableList{size=0} deletions=ExecutableList{size=1} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - select gen_id( SEQ_HISTORIAOP, 1 ) from RDB$DATABASE
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=4} updates=ExecutableList{size=0} deletions=ExecutableList{size=1} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - select rezerwacja0_.OSOBA_ID as OSOBA_ID1_148_, rezerwacja0_.REZERWACJA_ID as REZERWAC2_148_ from Rezerwacjaosoba rezerwacja0_ where rezerwacja0_.REZERWACJA_ID=?
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=4} updates=ExecutableList{size=0} deletions=ExecutableList{size=1} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=4} updates=ExecutableList{size=0} deletions=ExecutableList{size=1} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - select ... from Rezerwacjaosoba rezerwacja0_ where rezerwacja0_.REZERWACJA_ID=? and rezerwacja0_.OSOBA_ID=?
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=4} updates=ExecutableList{size=0} deletions=ExecutableList{size=1} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=4} updates=ExecutableList{size=0} deletions=ExecutableList{size=1} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - select ... from Usluga usluga0_ where usluga0_.REZERWACJA_ID=?
2019-01-09 12:54:48 - Found thread-bound EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=4} updates=ExecutableList{size=0} deletions=ExecutableList{size=1} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for JPA transaction
2019-01-09 12:54:48 - Participating in existing transaction
2019-01-09 12:54:48 - select ... from Usluga usluga0_ where usluga0_.USLUGA_ID=?
2019-01-09 12:54:48 - Initiating transaction commit
2019-01-09 12:54:48 - Committing JPA transaction on EntityManager [SessionImpl(PersistenceContext[entityKeys=[...],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=4} updates=ExecutableList{size=0} deletions=ExecutableList{size=1} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])]
2019-01-09 12:54:48 - insert into Ccard ...
2019-01-09 12:54:48 - insert into Historiaop ...
2019-01-09 12:54:48 - insert into Historiaop ...
2019-01-09 12:54:48 - insert into Historiaop ...
2019-01-09 12:54:48 - update Rezerwacja set ... where REZERWACJA_ID=?
2019-01-09 12:54:48 - delete from Ccard where CCARD_ID=?
2019-01-09 12:54:48 - Not closing pre-bound JPA EntityManager after transaction
2019-01-09 12:54:48 - Closing JPA EntityManager in OpenEntityManagerInViewInterceptor
2019-01-09 12:54:48 - Closing JPA EntityManager
2019-01-09 12:54:48 - Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@4869f607
2019-01-09 12:54:48 - Opening JPA EntityManager in OpenEntityManagerInViewInterceptor
2019-01-09 12:54:48 - Closing JPA EntityManager in OpenEntityManagerInViewInterceptor
2019-01-09 12:54:48 - Closing JPA EntityManager
Я получил исключение в строке 294 (я делаю это с намерением проверить транзакцию, это не ошибка), и данные сохраняются / обновляются в таблицах Rezerwacja, CCard и Historiaop.
Когда в этом методе возникла исключительная ситуация, я хочу, чтобы транзакция была отменена.