I'm developing a standalone application with following technology stack:

  • Spring Boot version 2.1.0.RELEASE
  • Oracle12c System with driver ojdbc6 (11.2.0.3)
  • Apache Camel
  • JPA for the main datasource
  • JDBC for a secondary datasource (read only)

The general purpose of this application is to poll csv files from a directory, do some transformations and store repectively data into the oracle database. After the file has been polled via camel's File2-component all following routes use the JPA-component to poll entities matching a certain status.

Here are the relevant JPA Entities:

ExchangeEntity: (this entity represents one csv file)

@Entity
@Table(name = "T_EXCHANGE")
@Getter
@NoArgsConstructor
public class ExchangeEntity {

public enum Status {
    NEW,
    PROCESSING,
    PROCESSING_ABORTED,
    PROCESSING_COMPLETED_WITH_ERRORS,
    PROCESSING_COMPLETED_WITHOUT_ERRORS,
    RELOCATION_FAILURE
}

@Id
@Type(type = "uuid-char")
@Column(name = "exchange_id", updatable = false)
@GeneratedValue(generator = "uuid")
@GenericGenerator(name="uuid", strategy = "org.hibernate.id.UUIDGenerator")
@Setter
private UUID id;

@Setter
@NotNull
@Enumerated(EnumType.STRING)
@Column(name = "status")
private Status status;

/* more irrelevant fields */
}

ProcessEntity: (this entity represents one processing step for an ExchangeEntity)

@Slf4j
@Entity
@Table(name = "T_PROCESS")
@Getter
@NoArgsConstructor
public class ProcessEntity {

@Id
@Type(type = "uuid-char")
@Column(name = "process_id", updatable = false)
private UUID id;

@Setter
@OneToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "fk_exchange_id")
private ExchangeEntity exchangeEntity;

@Setter
@NotBlank
@Column(name = "processor_status")
private String status;

@Setter
@Column(name = "consumed")
private Boolean consumed;

/* more irrelevant fields */

@PreConsumed
public void markAsConsumed(){
    this.consumed = true;
}
}

This is how I poll the Entities

[jpa://ProcessEntity?consumeDelete=false&consumer.namedQuery=notificationCompilerSelectQuery&consumer.transacted=false&entityType=com.foo.bar.entity.ProcessEntity&maximumResults=1&transactionManager=%23applicationTransactionManager]

Here are the two Datasource configurations:

ApplicationDatasourceConfig (JPA)

@Configuration
@EnableJpaRepositories(basePackages = "foo.bar.repository.jpa",
                       entityManagerFactoryRef = "applicationEntityManagerFactory",
                       transactionManagerRef = "applicationTransactionManager")
@ConfigurationProperties(prefix = "spring.datasource.hikari")
@EnableTransactionManagement
public class ApplicationDatasourceConfig extends HikariConfig{

@Bean("applicationDatasource")
@Primary
public DataSource applicationDataSource(){
    return new HikariDataSource(this);
}

@Bean("applicationDatasourceProperties")
@Primary
public DataSourceProperties dataSourceProperties(){
    return new DataSourceProperties();
}

@Bean("applicationEntityManagerFactory")
public LocalContainerEntityManagerFactoryBean applicationEntityManagerFactory(EntityManagerFactoryBuilder builder,
                                                                              @Qualifier("applicationDatasource") DataSource dataSource){

    return builder
            .dataSource(dataSource)
            .packages("foo.bar.entity")
            .build();
}

@Bean("applicationTransactionManager")
@Primary
public PlatformTransactionManager applicationTransactionManager(@Qualifier("applicationEntityManagerFactory")EntityManagerFactory entityManagerFactory){
    return new JpaTransactionManager(entityManagerFactory);
}
}

SecondaryDatasourceConfig (JDBC)

@Configuration
@ConfigurationProperties(prefix = "secondary.datasource")
@EnableTransactionManagement
public class SecondaryDatasourceConfig {

@Bean("secondaryDatasource")
public DataSource secondaryDataSource(){
    return secondaryDataSourceProperties().initializeDataSourceBuilder().build();
}

@Bean
public DataSourceProperties secondaryDataSourceProperties(){
    return new DataSourceProperties();
}

@Bean("secondaryTransactionManager")
public PlatformTransactionManager secondaryTransactionManager(@Qualifier("secondaryDatasource") DataSource secondaryDataSource){
    return new DataSourceTransactionManager(secondaryDataSource);
}
}

So the overall workflow looks like this:

  1. Poll Csv File
  2. Create an ExchangeEntity and store it with status = 'PROCESSING' in the database
  3. Create a ProcessEntity with reference to that ExchangeEntity and status = 'foo' in the database
  4. END OF File2-Component-Route
  5. Route 4711 polls entity with namedQuery matching status = 'foo' (entity will be marked as consumed on poll)
  6. Route 4711 creates its own ProcessEntity with reference to that ExchangeEntity and status = 'processing' in the database
  7. Route 4711 does some transformation
  8. Route 4711 updates status of ProcessEntity to status = 'bar'
  9. END OF ROUTE 4711
  10. Route 4812 polls entity with namedQuery matching status = 'bar' (entity will be marked as consumed on poll)
  11. Route 4812 creates its own ProcessEntity with reference to that ExchangeEntity and status = 'processing' in the database
  12. Route 4812 does some transformation
  13. Route 4812 updates status of ProcessEntity to status = 'foo bar'
  14. END OF ROUTE 4812
  15. MORE ROUTES
  16. Update status of ExchangeEntity to status = 'FINISHED' when all routes have finished

So in one route the application accesses the secondary datasource with a predefined sql statement from another developer executed by a jdbcTemplate instance. If the query throws an exception during runtime, this exception gets caught by a custom error processor registered for this route. In this case the application will do the following:

  1. Execute SQL Statement with jdbcTemplate on secondary datasource (also oracle; readonly)
  2. ----> Exception
  3. catch Exception and throw custom exception instead
  4. ErrorProcessor for route gets invoked
  5. Update status of the ProcessEntity like status = 'sql_failure'
  6. Update status of ExchangeEntity like status = 'PROCESSING_ABORTED'
  7. Application shuts down

This is how I update the status of the ProcessEntity:

final ProcessEntity processEntity = getProcessEntity(exchange);
processEntity.setStatus(status);
processEntity.setEndDate(new Date());

processEntityRepository.save(processEntity);

This is how I update the status of the ExchangeEntity:

ExchangeEntity exchangeEntity = getExchangeEntity(exchange);

exchangeEntity.setStatus(ExchangeEntity.Status.PROCESSING_ABORTED);
exchangeEntity.setStatusDate(new Date());

Here I dont have to call the repository explicitly since the entity will be updated after the route ends.

When I intentionally specify an unknwon schema (in this case 'FOO') in the sql statement I get the following exception:

at com.foo.bar.repository.jdbc.ImxJdbcRepository.findImxEmailRecipientsForAF(ImxJdbcRepository.java:79)
    at com.foo.bar.repository.jdbc.ImxJdbcRepository$$FastClassBySpringCGLIB$$735660cf.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
    at com.foo.bar.repository.jdbc.ImxJdbcRepository$$EnhancerBySpringCGLIB$$aaf475c8.findImxEmailRecipientsForAF(<generated>)
    at com.foo.bar.service.imx.EmailService.getAfRecipients(EmailService.java:58)
    at com.foo.bar.component.notificationcompiler.processor.NotificationDataAggregator.getRecipients(NotificationDataAggregator.java:92)
    at com.foo.bar.component.notificationcompiler.processor.NotificationDataAggregator.createNotificationModel(NotificationDataAggregator.java:116)
    at com.foo.bar.component.notificationcompiler.processor.NotificationDataAggregator.process(NotificationDataAggregator.java:66)
    at org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)
    at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
    at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:541)
    at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198)
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:120)
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
    at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198)
    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:97)
    at org.apache.camel.component.jpa.JpaConsumer.processBatch(JpaConsumer.java:196)
    at org.apache.camel.component.jpa.JpaConsumer$1.doInTransaction(JpaConsumer.java:128)
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
    at org.apache.camel.component.jpa.JpaConsumer.poll(JpaConsumer.java:102)
    at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174)
    at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL "...." SQL state [90079]; error code [90079]; Schema "FOO" nicht gefunden
Schema "FOO" not found; SQL statement:

Schema "FOO" not found; SQL statement:
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:89)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
    at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1414)
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:632)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:669)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:700)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:712)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:763)
    at com.foo.bar.repository.jdbc.ImxJdbcRepository.findImxEmailRecipientsForAF(ImxJdbcRepository.java:76)
    ... 36 more
Caused by: org.h2.jdbc.JdbcSQLException: Schema "FOO" nicht gefunden
Schema "FOO" not found; SQL statement:
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:357)
    at org.h2.message.DbException.get(DbException.java:179)
    at org.h2.message.DbException.get(DbException.java:155)
    at org.h2.command.Parser.getSchema(Parser.java:701)
    at org.h2.command.Parser.getSchema(Parser.java:707)
    at org.h2.command.Parser.readTableFilter(Parser.java:1388)
    at org.h2.command.Parser.parseSelectSimpleFromPart(Parser.java:2138)
    at org.h2.command.Parser.parseSelectSimple(Parser.java:2287)
    at org.h2.command.Parser.parseSelectSub(Parser.java:2133)
    at org.h2.command.Parser.parseSelectUnion(Parser.java:1946)
    at org.h2.command.Parser.parseSelect(Parser.java:1919)
    at org.h2.command.Parser.parsePrepared(Parser.java:463)
    at org.h2.command.Parser.parse(Parser.java:335)
    at org.h2.command.Parser.parse(Parser.java:307)
    at org.h2.command.Parser.prepareCommand(Parser.java:278)
    at org.h2.engine.Session.prepareLocal(Session.java:611)
    at org.h2.engine.Session.prepareCommand(Session.java:549)
    at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1247)
    at org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:76)
    at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:304)
    at com.zaxxer.hikari.pool.ProxyConnection.prepareStatement(ProxyConnection.java:311)
    at com.zaxxer.hikari.pool.HikariProxyConnection.prepareStatement(HikariProxyConnection.java)
    at org.springframework.jdbc.core.JdbcTemplate$SimplePreparedStatementCreator.createPreparedStatement(JdbcTemplate.java:1527)
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:615)
    ... 41 more

2019-04-05 16:05:58.704  WARN 12324 --- [//ProcessEntity] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 1461, SQLState: 72000
2019-04-05 16:05:58.704 ERROR 12324 --- [//ProcessEntity] o.h.engine.jdbc.spi.SqlExceptionHelper   : ORA-01461: Ein LONG-Wert kann nur zur Einfügung in eine LONG-Spalte gebunden werden

2019-04-05 16:05:58.716 ERROR 12324 --- [//ProcessEntity] o.h.i.ExceptionMapperStandardImpl        : HHH000346: Error during managed flush [org.hibernate.exception.GenericJDBCException: could not execute statement]
2019-04-05 16:05:58.752  WARN 12324 --- [//ProcessEntity] o.a.camel.component.jpa.JpaConsumer      : Consumer Consumer[jpa://ProcessEntity?consumeDelete=false&consumer.namedQuery=notificationCompilerSelectQuery&consumer.transacted=false&entityType=com.foo.bar.entity.ProcessEntity&maximumResults=1&transactionManager=%23applicationTransactionManager] failed polling endpoint: jpa://ProcessEntity?consumeDelete=false&consumer.namedQuery=notificationCompilerSelectQuery&consumer.transacted=false&entityType=com.foo.bar.entity.ProcessEntity&maximumResults=1&transactionManager=%23applicationTransactionManager. Will try again at next poll. Caused by: [javax.persistence.PersistenceException - org.springframework.orm.jpa.JpaSystemException: could not execute statement; nested exception is org.hibernate.exception.GenericJDBCException: could not execute statement]

javax.persistence.PersistenceException: org.springframework.orm.jpa.JpaSystemException: could not execute statement; nested exception is org.hibernate.exception.GenericJDBCException: could not execute statement
    at org.apache.camel.component.jpa.JpaConsumer.poll(JpaConsumer.java:160) ~[camel-jpa-2.19.0.jar:2.19.0]
    at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174) [camel-core-2.19.0.jar:2.19.0]
    at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101) [camel-core-2.19.0.jar:2.19.0]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_191]
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_191]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_191]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_191]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_191]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_191]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_191]
Caused by: org.springframework.orm.jpa.JpaSystemException: could not execute statement; nested exception is org.hibernate.exception.GenericJDBCException: could not execute statement
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:351) ~[spring-orm-5.1.2.RELEASE.jar:5.1.2.RELEASE]
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:253) ~[spring-orm-5.1.2.RELEASE.jar:5.1.2.RELEASE]
    at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:536) ~[spring-orm-5.1.2.RELEASE.jar:5.1.2.RELEASE]
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:746) ~[spring-tx-5.1.2.RELEASE.jar:5.1.2.RELEASE]
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:714) ~[spring-tx-5.1.2.RELEASE.jar:5.1.2.RELEASE]
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:152) ~[spring-tx-5.1.2.RELEASE.jar:5.1.2.RELEASE]
    at org.apache.camel.component.jpa.JpaConsumer.poll(JpaConsumer.java:102) ~[camel-jpa-2.19.0.jar:2.19.0]
    ... 9 common frames omitted
Caused by: org.hibernate.exception.GenericJDBCException: could not execute statement
    at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
    at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:178) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3171) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3686) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
    at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:90) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
    at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:604) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
    at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:478) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
    at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:356) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
    at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
    at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1454) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
    at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:511) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
    at org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:3283) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
    at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:2479) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
    at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:473) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
    at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.beforeCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:178) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
    at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.access$300(JdbcResourceLocalTransactionCoordinatorImpl.java:39) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
    at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:271) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
    at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:98) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
    at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:532) ~[spring-orm-5.1.2.RELEASE.jar:5.1.2.RELEASE]
    ... 13 common frames omitted
Caused by: java.sql.SQLException: ORA-01461: Ein LONG-Wert kann nur zur Einfügung in eine LONG-Spalte gebunden werden

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445) ~[ojdbc6-11.2.0.3.jar:11.2.0.3.0]
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396) ~[ojdbc6-11.2.0.3.jar:11.2.0.3.0]
    at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879) ~[ojdbc6-11.2.0.3.jar:11.2.0.3.0]
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:450) ~[ojdbc6-11.2.0.3.jar:11.2.0.3.0]
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192) ~[ojdbc6-11.2.0.3.jar:11.2.0.3.0]
    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531) ~[ojdbc6-11.2.0.3.jar:11.2.0.3.0]
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:207) ~[ojdbc6-11.2.0.3.jar:11.2.0.3.0]
    at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1044) ~[ojdbc6-11.2.0.3.jar:11.2.0.3.0]
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1329) ~[ojdbc6-11.2.0.3.jar:11.2.0.3.0]
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3584) ~[ojdbc6-11.2.0.3.jar:11.2.0.3.0]
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3665) ~[ojdbc6-11.2.0.3.jar:11.2.0.3.0]
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1352) ~[ojdbc6-11.2.0.3.jar:11.2.0.3.0]
    at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61) ~[HikariCP-3.2.0.jar:na]
    at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java) ~[HikariCP-3.2.0.jar:na]
    at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:175) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
    ... 30 common frames omitted

Furthermore the workaround to handle exceptions like explained above (updating statuses) does NOT work. Somehow JPA cant commit the transaction even though the exception occurred on another datasource

I have already tried to annotate the respective methods with @Transaction(noRollbackFor = Exception.class) but this does not solve the problem.

I should also mention that this behaviour ONLY occurres with Oracle - when I use the H2 In Memory DB during local development/testing everything works fine and the error workflow gets executed properly.

Has anyone an idea? I would really appreciate any helpful comments!

Thanks in advance.

0 Answers