la escritura por lotes de eclipselink está deshabilitada cuando se usa la política de historial o DescriptorEventAdapter
Intento usar la política del historial de eclipselink para registrar el historial de cambios de una tabla / entidad. También uso DescriptorEventAdapter / aboutToInsert, aboutToUpdate, aboutToDelete hooks para insertar el registro de auditoría. Todo funciona bien, excepto que encontré que la opción de escritura por lotes no funcionó después de aplicar las características anteriores.
<property name="eclipselink.jdbc.batch-writing" value="JDBC" />
El código es como:
for (int i = 0; i <= 3; i++) {
MyEntity e= new MyEntity ();
e.setName("insert-" + i);
entityManager.save(e);
}
Cuando deshabilito history / DescriptorEventAdapter, el sql es como:
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]
Después de aplicar el historial / 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]
¿Podría por favor darme alguna sugerencia? Gracias por adelantado.