I am upgrading an existing application to use JBoss EAP 6.4 with Hibernate 4.2. Code that previously worked that would select a row from the database, delete it, process the data, and loop back around, now seems to loop around and find the same row again. Multiple loops within a single JTA transaction seem to return the same row multiple times after I have deleted it. Once the JTA transaction commits, then the row is gone.
You can see below the "Object was already deleted' line. However, this is happening, because the same data is return from a query after it has been deleted. Any ideas as to what is causing the problem?
Code:
DELETE
20:51:08,663 TRACE [org.hibernate.event.internal.DefaultDeleteEventListener] (ThreadPoolExecutor-0) Deleting a persistent instance
20:51:08,663 TRACE [org.hibernate.event.internal.DefaultDeleteEventListener] (ThreadPoolExecutor-0) Deleting [PriorityWeightedScheduledTransaction#11659]
20:51:08,663 TRACE [org.hibernate.internal.SessionImpl] (ThreadPoolExecutor-0) Setting cache mode to: GET
20:51:08,663 TRACE [org.hibernate.internal.SessionImpl] (ThreadPoolExecutor-0) Setting cache mode to: NORMAL
20:51:08,663 TRACE [org.hibernate.internal.SessionImpl] (ThreadPoolExecutor-0) Setting cache mode to: GET
20:51:08,663 TRACE [org.hibernate.internal.SessionImpl] (ThreadPoolExecutor-0) Setting cache mode to: NORMAL
20:51:08,663 TRACE [org.springframework.transaction.interceptor.TransactionInterceptor] (ThreadPoolExecutor-0) Completing transaction for [HibernateCentralTransactionImpl.deletePriorityWeightedScheduledTransaction]
SELECT
0:51:08,662 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] ThreadPoolExecutor-0) Participating in existing transaction
20:51:08,663 TRACE [org.springframework.transaction.interceptor.TransactionInterceptor] (ThreadPoolExecutor-0) Getting transaction for [HibernateCentralTransactionImpl.deletePriorityWeightedScheduledTransaction]
20:51:08,807 TRACE [org.springframework.transaction.interceptor.TransactionInterceptor]
20:51:08,807 DEBUG [org.hibernate.stat.internal.ConcurrentStatisticsImpl] (ThreadPoolExecutor-0) HHH000117: HQL: from PriorityWeightedScheduledTransaction priorityWeightedScheduledTransaction where priorityWeightedScheduledTransaction.priority = ? and priorityWeightedScheduledTransaction.processingTypeId in (5) and priorityWeightedScheduledTransaction.searchTypeId in (1) and priorityWeightedScheduledTransaction.databaseTypeId in (1) order by priorityWeightedScheduledTransaction.priority, priorityWeightedScheduledTransaction.id asc, time: 1ms, rows: 0
20:51:08,807 TRACE [org.springframework.transaction.interceptor.TransactionInterceptor] (priorityFlowControllerThreadPoolExecutor-0) Completing transaction for [HibernateCentralTransactionImpl.getPriorityWeightedScheduledCentralTransactionIdIterator]
20:51:08,807 DEBUG [org.hibernate.internal.IteratorImpl] (ThreadPoolExecutor-0) Assembling results
20:51:08,807 TRACE [org.hibernate.type.descriptor.sql.BasicExtractor] (ThreadPoolExecutor-0) Found [11659] as column [col_0_0_]
DELETE AGAIN
20:51:08,994 TRACE [org.springframework.transaction.interceptor.TransactionInterceptor] (ThreadPoolExecutor-0) Getting transaction for [HibernateCentralTransactionImpl.deletePriorityWeightedScheduledTransaction]
20:51:08,994 TRACE [org.hibernate.event.internal.DefaultDeleteEventListener] (ThreadPoolExecutor-0) Deleting a persistent instance
20:51:08,994 TRACE [org.hibernate.event.internal.DefaultDeleteEventListener] (ThreadPoolExecutor-0) Object was already deleted
20:51:08,994 TRACE [org.springframework.transaction.interceptor.TransactionInterceptor] (ThreadPoolExecutor-0) Completing transaction for [HibernateCentralTransactionImpl.deletePriorityWeightedScheduledTransaction]