Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 311225

Summary: jpa validation failure with callback
Product: z_Archived Reporter: Sherry Hill <sherry.hill>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: mitesh.meswani
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch none

Description Sherry Hill CLA 2010-04-30 14:15:09 EDT
Build Identifier: 2.0.2.v20100323-r6872

Persisted employee of long name without proper validation on
Eclipse Persistence Services - 2.0.2.v20100323-r6872.
This is a regression from 2.0.1.v20100213-r6600. 

Reproducible: Always

Steps to Reproduce:
Please see the steps to reproduce failure and test source in
https://glassfish.dev.java.net/issues/show_bug.cgi?id=11831
Comment 1 Gordon Yorke CLA 2010-04-30 14:57:13 EDT
This issue exists because the initialization code was not updated to support initializing the hasAnyEventListeners when validation listeners were added.  Subsequent changes to initialize the DescriptorEventManager reset the bootstrap setting of this flag.

The easiest workaround is to add an entity listener to the Entity being validated.  Another workaround is to manually cause the flag within the DescriptorEventManager for the validated descriptor  to be set on.  Do this by adding a 'dummy' Listener then removing it.

DescriptorEventAdapter dummyListener = new DescriptorEventAdapter();
DescriptorEventManager eventManager = em.unwrap(Session.class).getDescriptor(Employee.class).getDescriptorEventManager();
eventManager.addListener(dummyListener);
eventManager.removeListener(dummyListener);
Comment 2 Gordon Yorke CLA 2010-04-30 15:47:14 EDT
Created attachment 166672 [details]
Patch

Adds code that checks for Internal Listeners during initialization.
Comment 3 Gordon Yorke CLA 2010-05-03 08:57:18 EDT
Patch checked in, Reviewed by Mitesh Meswani, verified using existing tests
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:29:27 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink