[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[eclipselink-dev] FYI: New bug -> 283145 - Broken backward compatibility of uow.registerNewObject under EntityManager
|
Bug extract:
Test case below is failing. We can easily find a workaround for this,
but the
point is that if nobody tested any of the old UOW API under
EntityManager it's
likely we will find a ton of other bugs. Anybody else ever used UOW
under
EntityManager? Is it supposed to work?
entityManager.getTransaction().begin();
TimecardRequest vacationRequest = new TimecardRequest();
RequestHistory requestHistory = new RequestHistory(vacationRequest);
vacationRequest.getRequestHistories().add(requestHistory);
// this doesn't work if we call flush before commit
// if remove flush it's working
UnitOfWork uow = getUnitOfWork(entityManager, requestHistory);
uow.registerNewObject(requestHistory);
// this work with flush or no flush
// entityManager.persist(requestHistory);
entityManager.flush();
entityManager.getTransaction().commit();
entityManager.close();
Error is:
Exception [EclipseLink-7197] (Eclipse Persistence Services -
1.1.2.v20090612-r4475):
org.eclipse.persistence.exceptions.ValidationException
Exception Description: Null primary key encountered in unit of work
clone
[com.saic.test.toplink.RequestHistory@719a719a].
at
org.eclipse.persistence.exceptions.ValidationException.nullPrimaryKeyInU
nitOfWorkClone(ValidationException.java:1310)
at
org.eclipse.persistence.descriptors.changetracking.DeferredChangeDetecti
onPolicy.calculateChanges(DeferredChangeDetectionPolicy.java:93)
at
org.eclipse.persistence.descriptors.changetracking.DeferredChangeDetecti
onPolicy.calculateChangesForExistingObject(DeferredChangeDetectionPolicy
.java:54)
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.calculateChange
s(UnitOfWorkImpl.java:582)
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabas
eWithChangeSet(UnitOfWorkImpl.java:1387)
at
org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.comm
itRootUnitOfWork(RepeatableWriteUnitOfWork.java:160)
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commit(UnitOfWo
rkImpl.java:1008)
at
org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.c
ommitInternal(EntityTransactionImpl.java:87)
at
org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.c
ommit(EntityTransactionImpl.java:63)