[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] @OptimisticLocking => NullPointerException
|
Hi Michael,
I see a potential bug in the code in
CascadeLockingPolicy.initUnmappedFieldsQuery, but cannot quite reproduce the
issue and hoping you can help me narrow it down.
Assuming you are using only JPA annotations/xml to map your model, the issue
appears to be related to a UnidirectionalOneToManyMapping (a OneToMany mapping
without a backpointer). Additionally, I expect that mapping should be
@PrivateOwned, or orphanRemoval=true.
In addition, you would likely see this where you are updating the target of a
relationship to a new object in a chain of objects with cascaded locking.
Anything you could do figure out which mapping you have that is causing the
problem and tell me how it is configured would help me identify the issue.
-tom
On 02/07/2013 8:54 AM, Michael Hönnig wrote:
Hi Tom,
What version of EclipseLink?
2.4.2.v20130315-93567e3
Please provide the full stack trace.
java.lang.NullPointerException
at
org.eclipse.persistence.internal.descriptors.CascadeLockingPolicy.initUnmappedFieldsQuery(CascadeLockingPolicy.java:241)
at
org.eclipse.persistence.internal.descriptors.CascadeLockingPolicy.initUnmappedFields(CascadeLockingPolicy.java:216)
at
org.eclipse.persistence.internal.descriptors.CascadeLockingPolicy.lockNotifyParent(CascadeLockingPolicy.java:272)
at
org.eclipse.persistence.internal.descriptors.CascadeLockingPolicy.lockNotifyParent(CascadeLockingPolicy.java:324)
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.calculateChanges(UnitOfWorkImpl.java:655)
at
org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.writeChanges(RepeatableWriteUnitOfWork.java:431)
at
org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:798)
at
com.sun.enterprise.container.common.impl.EntityManagerWrapper.flush(EntityManagerWrapper.java:418)
What object is involved, how is it mapped?
The main entity class has these annotations:
@Entity
@Table(name = "CUSTOMER_AGREEMENT", uniqueConstraints =
@UniqueConstraint(columnNames = "AGREEMENT_NO"))
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(name = "CONTRACT_TYPE", discriminatorType =
DiscriminatorType.STRING, length = 1)
@OptimisticLocking(cascade = true)
public abstract class AgreementEntity ...
But the whole entity structure is pretty complex. I would need some hint on
which parts to concentrte to extract it to reproduce the problem with a more
simple structure.
Best regards
... Michael
On 01/07/2013 12:22 PM, Michael Hönnig wrote:
Dear EclipseLink community,
We are getting a NullPointerExcption when using @OptimisticLocking.
org.eclipse.persistence.internal.descriptors.CascadeLockingPolicy
is the class where it happens:
CascadeLockingPolicy.initUnmappedFieldsQuery(...) {
...
SQLSelectStatement statement = new SQLSelectStatement();
Iterator<DatabaseField> itUnmappedFields =
m_unmappedQueryKeyFields.values().iterator();
...
}
called by
CascadeLockingPolicy.initUnmappedFields(...) {
...
if(m_unmappedQueryKeyFields.isEmpty()) {
m_unmappedQueryKeyFields = null;
m_mappedQueryKeyFields = m_queryKeyFields;
}
initUnmappedFieldsQuery(uow);
...
}
Just 2 statements before initUnmappedFieldsQuery() is using
m_unmappedQueryKeyFields, it is set to null.
Is ths a bug or does anybody know which circumstances, e.g. annotations in our
entities, could lead to this problem?`
Best regards
... Michael
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users