Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 336009 - [EclipseLink] enumerated element is automatically added for id mapping
Summary: [EclipseLink] enumerated element is automatically added for id mapping
Status: VERIFIED FIXED
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: General (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.0 M6   Edit
Assignee: Nan Li CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-01 14:32 EST by Nan Li CLA
Modified: 2011-04-26 12:44 EDT (History)
3 users (show)

See Also:
karenfbutzke: review+


Attachments
Patch (1.46 KB, patch)
2011-02-01 17:25 EST, Nan Li CLA
neil.hauge: iplog+
Details | Diff
Patch (2.61 KB, patch)
2011-02-03 17:03 EST, Nan Li CLA
karenfbutzke: iplog+
karenfbutzke: review+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nan Li CLA 2011-02-01 14:32:56 EST
Build Identifier: I20101028-1441

Every time map an attribute of an EclipseLink mapping file as id mapping, the enumerated element is automatically added for the mapping, like 

<id name="foo_id">
   <enumerated>ORDINAL</enumerated>
</id>

The enumerated element does not apply to id mapping. The problem only exists with the EclipseLink mapping file.

Reproducible: Always

Steps to Reproduce:
1. Create an EclipseLink mapping file
2. Add an attribute to the mapping file and map it as ID mapping
Comment 1 Nan Li CLA 2011-02-01 17:25:50 EST
Created attachment 188098 [details]
Patch
Comment 2 Neil Hauge CLA 2011-02-03 12:08:43 EST
Looks good.  Enumerated didn't belong there, as you mentioned.  Patch committed to head.
Comment 3 Karen Butzke CLA 2011-02-03 12:43:00 EST
I should have looked at this sooner. enumerated is supported on id mappings, but only in the eclipselink 2.2 orm schema. The resource model is written in such a way that the translators are for the latest version of the schema, shouldn't hurt to have extra translators for things that won't ever appear in the file.  The real solution here is in o.e.jpt.core.resource.orm.XmlId the static file ENUMERATED_EDEFAULT needs to be changed to the following. We have to change what EMF has generated and make sure it doesn't regenerate over it by removing the @generated javadoc. You can see the same thing being done in o.e.jpt.core.resource.orm.XmlBasic

/**
* changed this to null and removed the generated flag so emf won't generate over * it we don't want a default for enums, just null if the tag does not exist
*/
protected static final EnumType ENUMERATED_EDEFAULT = null;
Comment 4 Nan Li CLA 2011-02-03 17:03:55 EST
Created attachment 188281 [details]
Patch

Integrated the comment and tested
Comment 5 Karen Butzke CLA 2011-02-10 18:03:50 EST
I have checked this patch in for 3.0M6
Comment 6 Jolene Moffitt CLA 2011-04-26 12:44:47 EDT
Verified in Build I-3.3.0-20110414085808

Verified when you add an ID mapped attribute to eclipselink-orm mapping file the <enumerated> tag does not appear in the Source.  See the link to view test steps for verification.  http://wiki.eclipse.org/Dali_3.0_M6