My Oracle Support Banner

Eclipselink 2.6.4 Of Weblogic 12.2.1.2 Does Not Properly Implement JSR 303 Bean Validations (Doc ID 2401182.1)

Last updated on MAY 25, 2018

Applies to:

Oracle TopLink - Version 12.2.1.2.0 and later
Information in this document applies to any platform.

Symptoms

Eclipselink Version 2.6.4 does not always determine when it is appropriate to run JSR validations on a modified bean.
The class org.eclipse.persistence.internal.jpa.metadata.listeners.BeanValidationListener

Its the critical central point to invoke J SR 303 bean validation on an entity.

Example:
boolean shouldValidate = noOptimization || beanValidationHelper.isConstrained(source.getClass());
The code above makes perfect logical sense.


The critical issue is the implementation
beanValidationHelper.isConstrained(source.getClass());

This implementation is NON RECURSIVE, and it will not detect that a Bean A needs to be validated when the J SR 303 annotation are on its parent:
@MappedSuperclass public abstract DummyParentEntity{
@NotNull
private String someFieldThatMustNotBeNull;
}

The work-around hack for this bug is to go to the child entity A and add into it
@Transient
@NotNull
private final char waitForEclipseLinkToFixTheVersion264 = 'a';

With this the following step will be evaluated to true and the J SR 303 validations get called.
boolean shouldValidate = noOptimization || beanValidationHelper.isConstrained(source.getClass());

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.