We recently upgraded java 8 to java 17 and Spring Framework from 5.3.31 to 6.1.3
Now the data is not getting inserted into db and it used to work fine in 5.3.31.
Hibernate ORM core version is 6.4.3.Final.
We have multiple data sources as following:
@Configuration
@EnableConfigurationProperties
@Slf4j
public class DataSourceConfig {
@Primary
@Bean(destroyMethod = "")
@ConfigurationProperties(prefix = "spring.datasource.primary")
public DataSource primaryDataSource(@Value("${spring.datasource.primary.username}")
String userName) {
HikariDataSource dataSource = DataSourceBuilder.create().type(HikariDataSource.class).build();
// set datasource properties...
// ..
return dataSource;
}
@Bean(destroyMethod = "", name = "secondaryDataSource")
@ConfigurationProperties(prefix = "spring.datasource.secondary")
public DataSource secondaryDataSource(@Value("${spring.datasource.secondary.username}")
String userName) {
HikariDataSource dataSource = DataSourceBuilder.create().type(HikariDataSource.class).build();
// ... some datasource configuration
return dataSource;
}
// .. some more datasource beans
}
We are putting @Transactional on all repositories as following:
@Repository
@Transactional
public interface JobDetailsRepository extends JpaRepository<JobDetails, String> {
}
We enabled transactions debug logging and following logs are appearing. New transaction is being created and committed, but we don't see data getting inserted in db.
2024-02-19T16:40:19.138Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] o.s.orm.jpa.JpaTransactionManager : Creating new transaction with name [org.springframework.data.jpa.repository.support.SimpleJpaRepository.save]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
2024-02-19T16:40:19.139Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] o.s.orm.jpa.JpaTransactionManager : Opened new EntityManager [SessionImpl(1877545655<open>)] for JPA transaction
2024-02-19T16:40:19.139Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] o.h.e.t.internal.TransactionImpl : On TransactionImpl creation, JpaCompliance#isJpaTransactionComplianceEnabled == false
2024-02-19T16:40:19.139Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] o.h.e.t.internal.TransactionImpl : begin
2024-02-19T16:40:19.141Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] o.s.orm.jpa.JpaTransactionManager : Exposing JPA transaction as JDBC [org.springframework.orm.jpa.vendor.HibernateJpaDialect$HibernateConnectionHandle@651179c7]
2024-02-19T16:40:19.141Z TRACE 10849 --- [TASK_MANAGER] [eline Service-2] o.s.t.i.TransactionInterceptor : Getting transaction for [org.springframework.data.jpa.repository.support.SimpleJpaRepository.save]
2024-02-19T16:40:19.141Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] o.h.j.internal.PersistenceUnitUtilImpl : jakarta.persistence.PersistenceUnitUtil.getIdentifier may not be able to read identifier of a detached entity
2024-02-19T16:40:19.141Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] org.hibernate.orm.sql.exec : Skipping reading Query result cache data: cache-enabled = false, cache-mode = IGNORE
2024-02-19T16:40:19.141Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] org.hibernate.orm.results : Initializer list:
com.oracle.cp360pipeline.taskmanager.entity.Job -> EntityResultInitializer(com.oracle.cp360pipeline.taskmanager.entity.Job)@130558238 (SingleTableEntityPersister(com.oracle.cp360pipeline.taskmanager.entity.Job))
2024-02-19T16:40:19.142Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] org.hibernate.SQL : select j1_0.JOB_ID,j1_0.APP_CODE,j1_0.CURRENT_JOB_STEP_TYPE,j1_0.FROM_DT,j1_0."W$_INSERT_DT",j1_0.JOB_END_DT,j1_0.JOB_START_DT,j1_0.JOB_TYPE,j1_0.STATUS,j1_0.TO_DT,j1_0."W$_UPDATE_DT",j1_0."W$_UPDATED_BY" from OPS_JOB j1_0 where j1_0.JOB_ID=?
2024-02-19T16:40:19.144Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] o.h.r.j.i.LogicalConnectionManagedImpl : Skipping aggressive release of JDBC Connection after-statement due to held resources
2024-02-19T16:40:19.144Z TRACE 10849 --- [TASK_MANAGER] [eline Service-2] o.s.t.i.TransactionInterceptor : Completing transaction for [org.springframework.data.jpa.repository.support.SimpleJpaRepository.save]
2024-02-19T16:40:19.144Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] o.s.orm.jpa.JpaTransactionManager : Initiating transaction commit
2024-02-19T16:40:19.144Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] o.s.orm.jpa.JpaTransactionManager : Committing JPA transaction on EntityManager [SessionImpl(1877545655<open>)]
2024-02-19T16:40:19.144Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] o.h.e.t.internal.TransactionImpl : committing
2024-02-19T16:40:19.144Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] o.h.e.i.AbstractFlushingEventListener : Processing flush-time cascades
2024-02-19T16:40:19.144Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] o.h.e.i.AbstractFlushingEventListener : Dirty checking collections
2024-02-19T16:40:19.144Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] o.h.e.i.AbstractFlushingEventListener : Flushed: 1 insertions, 0 updates, 0 deletions to 1 objects
2024-02-19T16:40:19.144Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] o.h.e.i.AbstractFlushingEventListener : Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
2024-02-19T16:40:19.145Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] o.hibernate.internal.util.EntityPrinter : Listing entities:
2024-02-19T16:40:19.145Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] o.hibernate.internal.util.EntityPrinter : com.oracle.cp360pipeline.taskmanager.entity.Job{fromDate=2022-05-15 10:13:22.546, jobEndDate=null, jobID=CPAnalytics.Incremental.CPAnalytics.2402151018386, updateDate=null, currentJobStepType=null, updatedBy=null, jobStartDate=2024-02-19 16:40:19.138, toDate=null, insertDate=2024-02-19 16:40:19.138, appCode=JIRA_SD_TRANSFORM, jobType=Scheduled, status=New}
2024-02-19T16:40:19.145Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] org.hibernate.SQL : insert into OPS_JOB (APP_CODE,CURRENT_JOB_STEP_TYPE,FROM_DT,"W$_INSERT_DT",JOB_END_DT,JOB_START_DT,JOB_TYPE,STATUS,TO_DT,"W$_UPDATE_DT","W$_UPDATED_BY",JOB_ID) values (?,?,?,?,?,?,?,?,?,?,?,?)
2024-02-19T16:40:19.147Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] o.h.r.j.i.LogicalConnectionManagedImpl : Initiating JDBC connection release from afterStatement
2024-02-19T16:40:19.149Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] com.zaxxer.hikari.pool.ProxyConnection : HikariPool-1 - Executed rollback on connection oracle.jdbc.driver.T4CConnection@5fd31df7 due to dirty commit state on close().
2024-02-19T16:40:19.149Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Reset (autoCommit) on connection oracle.jdbc.driver.T4CConnection@5fd31df7
2024-02-19T16:40:19.150Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] o.h.r.j.i.LogicalConnectionManagedImpl : Initiating JDBC connection release from afterTransaction
2024-02-19T16:40:19.150Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] o.h.r.j.i.LogicalConnectionManagedImpl : Initiating JDBC connection release from afterTransaction
2024-02-19T16:40:19.150Z DEBUG 10849 --- [TASK_MANAGER] [eline Service-2] o.s.orm.jpa.JpaTransactionManager : Closing JPA EntityManager [SessionImpl(1877545655<open>)] after transaction
Hikari Configuration:
2024-02-19T16:34:23.913Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : HikariPool-1 - configuration:
2024-02-19T16:34:23.916Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : allowPoolSuspension.............false
2024-02-19T16:34:23.917Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : autoCommit......................true
2024-02-19T16:34:23.917Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : catalog.........................none
2024-02-19T16:34:23.917Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : connectionInitSql...............none
2024-02-19T16:34:23.917Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : connectionTestQuery.............none
2024-02-19T16:34:23.917Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : connectionTimeout...............30000
2024-02-19T16:34:23.918Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : dataSource......................none
2024-02-19T16:34:23.918Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : dataSourceClassName.............none
2024-02-19T16:34:23.918Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : dataSourceJNDI..................none
2024-02-19T16:34:23.918Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : dataSourceProperties............{password=<masked>}
2024-02-19T16:34:23.918Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : driverClassName................."oracle.jdbc.OracleDriver"
2024-02-19T16:34:23.919Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : exceptionOverrideClassName......none
2024-02-19T16:34:23.919Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : healthCheckProperties...........{}
2024-02-19T16:34:23.919Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : healthCheckRegistry.............none
2024-02-19T16:34:23.919Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : idleTimeout.....................30000
2024-02-19T16:34:23.919Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : initializationFailTimeout.......1
2024-02-19T16:34:23.919Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : isolateInternalQueries..........false
2024-02-19T16:34:23.919Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : jdbcUrl.........................jdbc:oracle:thin:@cp360dev_low?TNS_ADMIN=***
2024-02-19T16:34:23.919Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : keepaliveTime...................0
2024-02-19T16:34:23.919Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : leakDetectionThreshold..........0
2024-02-19T16:34:23.919Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : maxLifetime.....................1800000
2024-02-19T16:34:23.919Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : maximumPoolSize.................10
2024-02-19T16:34:23.920Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : metricRegistry..................none
2024-02-19T16:34:23.920Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : metricsTrackerFactory...........none
2024-02-19T16:34:23.920Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : minimumIdle.....................2
2024-02-19T16:34:23.920Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : password........................<masked>
2024-02-19T16:34:23.920Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : poolName........................"HikariPool-1"
2024-02-19T16:34:23.920Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : readOnly........................false
2024-02-19T16:34:23.920Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : registerMbeans..................false
2024-02-19T16:34:23.920Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : scheduledExecutor...............none
2024-02-19T16:34:23.920Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : schema..........................none
2024-02-19T16:34:23.920Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : threadFactory...................internal
2024-02-19T16:34:23.920Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : transactionIsolation............default
2024-02-19T16:34:23.920Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : username........................"****"
2024-02-19T16:34:23.921Z DEBUG 10849 --- [TASK_MANAGER] [ main] com.zaxxer.hikari.HikariConfig : validationTimeout...............5000
HikariPool-1 - Executed rollback on connection oracle.jdbc.driver.T4CConnection@5fd31df7 due to dirty commit state on close().
Are you sure your code works ok ?