Community
Participate
Working Groups
We are preparing our code to deploy in JEE7 WEBLOGIC 12.2.1.2 container. We are changing our POMS to use the same library version that weblogic 12.2.1.2 uses to provided the different JEE standards. In the case of JPA 2.1 weblogic seems to bundle eclipse link 2.6.4 version. The most patch fixed version of eclipse link. While validating integration tests for our application, we have verified already two critical bugs in eclipse link code in terms of properly upholding the usage of bean validations in its internal workflow. Issue #1 ( see the bug request # 25237864). Issue #2: The BeanValidationListener class above only subscribes to events: preUpdate,preRemove,prePersist. This is clearly not sufficient.
tried the re-producer attached , the points are [eclipse link version 2.6.4] -@Test public void placeboTest() This test case is executing as expected , throwing ConstraintViolationException -demonstrateHowWeCanViolateBusinessRulesByFollowingADifferentFlow This is failing , here we are using a different approach : - not creating new Bug2Entity() object , we modify the already existing entity with invalid scenario . So that breaks Please confirm the points
Yes, points you have mentioned is true. Customer's update: But that is what this service request/Bug has been about from the start. This thread is about the fact that when we: 1. em.perist(entity) 2. modify(entity) violation assertion rules 3. commit we are able to commit the entity violation JPA constraint validations.
Problem summery ------------- Here the issue is direct persist works good , its throwing a ConstraintViolationException if any Bug2Entity ageValidationEntity = new Bug2Entity(); ageValidationEntity.setNotNullField("InThisTestTheNotNullFieldIsIrrelevantToUs"); ageValidationEntity.setAge(ALLOWED_AGE); em.persist(ageValidationEntity); but if we try to modify the persisted bean within the same transaction and committed it is not checking constrained Violations // (a) we start by calling persist on a fresh new entity thaat starts off being valid Bug2Entity ageValidationEntity = new Bug2Entity(); ageValidationEntity.setNotNullField("InThisTestTheNotNullFieldIsIrrelevantToUs"); ageValidationEntity.setAge(ALLOWED_AGE); em.persist(ageValidationEntity); // (b) now we demonstrate how eclipse link fails to invoke the JSR validations on entity // when we modify the entity during the transaction try { ageValidationEntity.setAge(NOT_ALLOWED_AGE); em.persist(ageValidationEntity); above persist will work , it won’t check for constrained Violations Resolution/fix ------------- From the eclipse link code analysis we can see the unit of work is only triggering the call back events while registering a new bean Refer : public void registerNewObjectForPersist(Object newObject, Map visitedObjects) Intern triggering the call back events in case of (registeredObject == null) While modifying the persisted object the object won’t be null and eventually this wont sufficient to trigger the call backs So we added another condition which will handle the modification case , it will trigger the callbacks if any listeners associated with that entity
https://github.com/eclipse-ee4j/eclipselink/pull/135/commits/475a1e803397baf3c557f682521f2261f734c821
Created attachment 274532 [details] testcase
GitHub Pull Request 185 created by [sureshbn] https://github.com/eclipse-ee4j/eclipselink/pull/185
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink