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

Bug 320449

Summary: DiscriminatorValue is not set on initial persist
Product: z_Archived Reporter: Mark Robinson <spamfilter>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P2 CC: christopher.delahunt, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Mark Robinson CLA 2010-07-20 18:34:20 EDT
Build Identifier: 1.0.0.0-1-2-0

When using an entity with a DiscriminatorValue notation, the value of DiscriminatorValue field not set when you do a persist.  This will cause errors later on if attempt to persist any changes made to the object later on.

The DiscriminatorValue field should be set to the correct value for the class on a persist.  This would operate similarly to the @IdGenerator concept.

Reproducible: Always

Steps to Reproduce:
1. Create a class which uses @DiscriminatorValue 
2. Create a new instance of the class
3. em.persist() the new instance.
3a. The DiscriminatorValue will not be set at this point.
4. Commit the transaction
5. Open a new TX and cause the class to attempt to be committed.
6. An error will return about DiscriminatorValue being null.
Comment 1 Tom Ware CLA 2010-08-09 13:57:03 EDT
Setting target and priority.  See the following page for details of the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
Comment 2 Chris Delahunt CLA 2010-08-30 10:48:49 EDT
This does not reproduce in any later versions I know of, but I have not gone back through all the versions to see where it might have been fixed.  Please try an EclipseLink version later than the 1.0 release (2.1.1 is the latest official release available at http://www.eclipse.org/eclipselink/downloads/index.php)
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:23:10 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink