Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » eclipselink batch write is disabled when use history policy or DescriptorEventAdapter(eclipselink batch write is disabled when use history policy or DescriptorEventAdapter)
eclipselink batch write is disabled when use history policy or DescriptorEventAdapter [message #1735172] Thu, 16 June 2016 05:31
Jacky Cheng is currently offline Jacky ChengFriend
Messages: 1
Registered: June 2016
Junior Member
I try to use eclipselink history policy to record the change history of one table/entity. I also use DescriptorEventAdapter/aboutToInsert,aboutToUpdate,aboutToDelete hooks to insert audit record. All things works well except that I found the batch-writing option did not work after I apply the features above.

<property name="eclipselink.jdbc.batch-writing" value="JDBC" />
The code is like:

for (int i = 0; i <= 3; i++) {
MyEntity e= new MyEntity ();
e.setName("insert-" + i);
entityManager.save(e);
}
When I disable history/DescriptorEventAdapter, the sql is like:

DEBUG o.e.p.s./.sql - INSERT INTO MY_ENTITY (ID, NAME) VALUES (?, ?)
DEBUG o.e.p.s./.sql - bind => [1, insert-0]
DEBUG o.e.p.s./.sql - bind => [2, insert-1]
DEBUG o.e.p.s./.sql - bind => [3, insert-2]
DEBUG o.e.p.s./.sql - bind => [4, insert-3]
After apply the history/DescriptorEventAdapter

DEBUG o.e.p.s./.sql - INSERT INTO MY_ENTITY (ID, NAME) VALUES (?, ?)
DEBUG o.e.p.s./.sql - bind => [1, insert-0]
DEBUG o.e.p.s./.sql - INSERT INTO MY_ENTITY_HIST (ID, NAME, VALID_FROM) VALUES (?, ?)
DEBUG o.e.p.s./.sql - bind => [1, insert-0, 2016-06-16 01:55:22.424]
DEBUG o.e.p.s./.sql - INSERT INTO MY_ENTITY (ID, NAME) VALUES (?, ?)
DEBUG o.e.p.s./.sql - bind => [2, insert-1]
DEBUG o.e.p.s./.sql - INSERT INTO MY_ENTITY_HIST (ID, NAME, VALID_FROM) VALUES (?, ?)
DEBUG o.e.p.s./.sql - bind => [2, insert-1, 2016-06-16 01:55:22.424]
DEBUG o.e.p.s./.sql - INSERT INTO MY_ENTITY (ID, NAME) VALUES (?, ?)
DEBUG o.e.p.s./.sql - bind => [3, insert-3]
DEBUG o.e.p.s./.sql - INSERT INTO MY_ENTITY_HIST (ID, NAME, VALID_FROM) VALUES (?, ?)
DEBUG o.e.p.s./.sql - bind => [3, insert-3, 2016-06-16 01:55:22.424]
DEBUG o.e.p.s./.sql - INSERT INTO MY_ENTITY (ID, NAME) VALUES (?, ?)
DEBUG o.e.p.s./.sql - bind => [4, insert-3]
DEBUG o.e.p.s./.sql - INSERT INTO MY_ENTITY_HIST (ID, NAME, VALID_FROM) VALUES (?, ?)
DEBUG o.e.p.s./.sql - bind => [4, insert-3, 2016-06-16 01:55:22.424]
Could you please give some suggestion this? Thanks in advance.
Previous Topic:JDBC Internal pool connections
Next Topic:Create CriteriaQuery against DynamicEntity
Goto Forum:
  


Current Time: Tue Sep 18 23:25:05 GMT 2018

Powered by FUDForum. Page generated in 0.01641 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top