admin管理员组文章数量:1318564
Using EclipseLink 2.6.4 with JTA and the property eclipselink.persistence-context.flush-mode=commit.
The UPDATE in the database is not done when I'm trying to commit a transaction where several merges are done on different objects (persisting is working fine). I checked the values and I was able to confirm that the new values are different from the data in database.
The transaction is started, committed, ended then restarted ... several times in the logic. The other commits work well before and after this one.
In addition, if I do the commit just after the merge, it's working fine but I would like to avoid as I would like to be able to rollback all actions if one of them is failing.
I activated the EclipseLink logs in FINEST, you will find an extract of them for the both cases:
Commit after several select and some merges (no UPDATE done in DB for object
movilitas.archiving.jpa.entity.archive.material.materialLot.ODSMaterialLot)
[EL Finer]: 2025-01-17 17:15:23.065--UnitOfWork(1790824463)--Thread(Thread[HTTP Worker [@1421579142],5,Dedicated_Application_Thread])--begin unit of work commit [EL Finer]: 2025-01-17 17:15:23.065--ClientSession(551861325)--Thread(Thread[HTTP Worker [@1421579142],5,Dedicated_Application_Thread])--TX beginTransaction, status=STATUS_ACTIVE [EL Finest]: 2025-01-17 17:15:23.065--UnitOfWork(1790824463)--Thread(Thread[HTTP Worker [@1421579142],5,Dedicated_Application_Thread])--Execute query UpdateObjectQuery(movilitas.archiving.jpa.entity.archive.ArchivingManagement@4633dca9) [EL Finest]: 2025-01-17 17:15:23.066--UnitOfWork(1790824463)--Thread(Thread[HTTP Worker [@1421579142],5,Dedicated_Application_Thread])--Execute query InsertObjectQuery(movilitas.archiving.jpa.entity.archive.ArchivingData@1f0b544c) [EL Fine]: 2025-01-17 17:15:23.066--ClientSession(551861325)--Connection(938909931)--Thread(Thread[HTTP Worker [@1421579142],5,Dedicated_Application_Thread])--INSERT INTO O95_ARCH_DATA (UIID, ARCH_TYPE, CHANGEDBY, CHANGEDON, CREATEDBY, CREATEDON, HISTORY, OBJECT_ID, OBJECT_JSON, OBJECT_NAME, OBJECT_RAW, OBJECT_XML, STATUS, TENANT, ARCH_MGMT) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) bind => [961, RAW, Guest, 2025-01-17 17:15:23.039, Guest, 2025-01-17 17:15:23.039, WIP->ODS_DIRTY, ELE_MaterialLot_10, null, MaterialLot, [B@34807356, null, ODS_DIRTY, default, 761] [EL Finest]: 2025-01-17 17:15:23.067--UnitOfWork(1790824463)--Thread(Thread[HTTP Worker [@1421579142],5,Dedicated_Application_Thread])--Execute query UpdateObjectQuery(movilitas.archiving.jpa.entity.archive.material.materialLot.ODSMaterialLot@348b939e) [EL Finest]: 2025-01-17 17:15:23.067--UnitOfWork(1790824463)--Thread(Thread[HTTP Worker [@1421579142],5,Dedicated_Application_Thread])--Execute query UpdateObjectQuery(movilitas.archiving.jpa.entity.archive.material.materialLot.ODSMaterialLotProperty@6f21d04d) [EL Finest]: 2025-01-17 17:15:23.067--UnitOfWork(1790824463)--Thread(Thread[HTTP Worker [@1421579142],5,Dedicated_Application_Thread])--Execute query UpdateObjectQuery(movilitas.archiving.jpa.entity.archive.material.materialLot.ODSMaterialLotProperty@29ecc706) [EL Finest]: 2025-01-17 17:15:23.068--ServerSession(101077745)--Connection(981032147)--Thread(Thread[HTTP Worker [@1421579142],5,Dedicated_Application_Thread])--Connection released to connection pool [default]. [EL Finer]: 2025-01-17 17:15:23.069--UnitOfWork(1790824463)--Thread(Thread[HTTP Worker [@1421579142],5,Dedicated_Application_Thread])--TX afterCompletion callback, status=COMMITTED [EL Finest]: 2025-01-17 17:15:23.075--ServerSession(101077745)--Thread(Thread[HTTP Worker [@1421579142],5,Dedicated_Application_Thread])--Propagating command asynchronously [EL Finer]: 2025-01-17 17:15:23.077--UnitOfWork(1790824463)--Thread(Thread[HTTP Worker [@1421579142],5,Dedicated_Application_Thread])--end unit of work commit
Commit immediately after each merge (UPDATE done in DB for object
movilitas.archiving.jpa.entity.archive.material.materialLot.ODSMaterialLot in table O95_MALT
[EL Finer]: 2025-01-17 17:39:16.277--UnitOfWork(1013035015)--Thread(Thread[HTTP Worker [@1540943114],5,Dedicated_Application_Thread])--begin unit of work commit [EL Finer]: 2025-01-17 17:39:16.277--ClientSession(1157391672)--Thread(Thread[HTTP Worker [@1540943114],5,Dedicated_Application_Thread])--TX beginTransaction, status=STATUS_ACTIVE [EL Finest]: 2025-01-17 17:39:16.277--UnitOfWork(1013035015)--Thread(Thread[HTTP Worker [@1540943114],5,Dedicated_Application_Thread])--Execute query UpdateObjectQuery(movilitas.archiving.jpa.entity.archive.material.materialLot.ODSMaterialLot@339a518b) [EL Finest]: 2025-01-17 17:39:16.277--ServerSession(1735080251)--Connection(662352849)--Thread(Thread[HTTP Worker [@1540943114],5,Dedicated_Application_Thread])--Connection acquired from connection pool [default]. [EL Finest]: 2025-01-17 17:39:16.277--ClientSession(1157391672)--Thread(Thread[HTTP Worker [@1540943114],5,Dedicated_Application_Thread])--reconnecting to external connection pool [EL Fine]: 2025-01-17 17:39:16.277--ClientSession(1157391672)--Connection(1173906560)--Thread(Thread[HTTP Worker [@1540943114],5,Dedicated_Application_Thread])--UPDATE O95_MALT SET CHANGEDON = ?, CUST01 = ?, CUST02 = ?, CUST03 = ?, CUST04 = ?, CUST05 = ?, CUST06 = ? WHERE (UIID = ?) bind => [2025-01-15 09:58:40.623, 0, 1, 2, 3, 4, 5, 39013] [EL Finest]: 2025-01-17 17:39:16.281--ServerSession(1735080251)--Connection(662352849)--Thread(Thread[HTTP Worker [@1540943114],5,Dedicated_Application_Thread])--Connection released to connection pool [default]. [EL Finer]: 2025-01-17 17:39:16.282--UnitOfWork(1013035015)--Thread(Thread[HTTP Worker [@1540943114],5,Dedicated_Application_Thread])--TX afterCompletion callback, status=COMMITTED
The context and data are exactly the same between both cases.
The only way I was able to achieve an UPDATE in the DB is to add a commit immediately after each merge.
I tried to use the clear method of the EntityManager before each merge without any success.
I logged the value of the changed field all along the process and until the commit, it contains the updated value but then, once committing the update is not happening in the database and any select query done through new thread returns the old value.
Could you please help me to find a root cause?
本文标签: JPA EclipseLink UPDATE Not Executed After Committing MergesStack Overflow
版权声明:本文标题:JPA EclipseLink: UPDATE Not Executed After Committing Merges - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742048028a2417907.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论