Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 347209 - Unable to add mappings to EclipseLink mapping file - UnsupportedOperationException thrown when trying to add orderable mapping to eclipselink-orm.xml
Summary: Unable to add mappings to EclipseLink mapping file - UnsupportedOperationExc...
Status: VERIFIED FIXED
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: General (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P1 major (vote)
Target Milestone: 3.0 RC3   Edit
Assignee: Brian Vosburgh CLA
QA Contact:
URL:
Whiteboard: PMC_approved
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-25 14:20 EDT by Nan Li CLA
Modified: 2011-06-28 11:25 EDT (History)
4 users (show)

See Also:
david_williams: pmc_approved+
neil.hauge: pmc_approved+
neil.hauge: pmc_approved? (naci.dai)
neil.hauge: pmc_approved? (deboer)
brian.vosburgh: pmc_approved?
neil.hauge: pmc_approved? (kaloyan)
neil.hauge: pmc_approved? (cbridgha)
neil.hauge: review+


Attachments
Stack Trace (8.01 KB, text/plain)
2011-05-25 14:22 EDT, Nan Li CLA
no flags Details
candidate patch (1.96 KB, patch)
2011-05-25 14:52 EDT, Brian Vosburgh CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nan Li CLA 2011-05-25 14:20:06 EDT
Build Identifier: I20110519-1138

1. Define a Java type mapping with an orderable relationship mapping (OneToMany or ManyToMany)

2. Create an EL mapping file and add the type mapping created in step 1 to it

3. In the JPA structure pane, right-click the relationship mapping defined in step 1 and try to add it to the EL mapping file

An UnsupportedOperationException is thrown saying

java.lang.UnsupportedOperationException: use #buildOrmOrderable(OrmAttributeMapping parent, Orderable2_0.Owner owner). 

A full stack trace is attached. 

PS: Trying to set a type mapping to cacheable also gives an UnsupportedOperationException.

Reproducible: Always
Comment 1 Nan Li CLA 2011-05-25 14:22:51 EDT
Created attachment 196587 [details]
Stack Trace
Comment 2 Brian Vosburgh CLA 2011-05-25 14:52:44 EDT
Created attachment 196595 [details]
candidate patch

We are checking whether the orm.xml file's version is "2.0"; but eclipselink-orm.xml files can have higher a version (e.g. "2.1"). Changed the check to whether the version is greater than "2.0". This, of course, assumes the eclipselink-orm.xml version is reasonably in sync with the spec orm.xml version.
Comment 3 Neil Hauge CLA 2011-05-25 16:31:25 EDT
    Explain why you believe this is a stop-ship defect. Or, if it is a "hotbug" (requested by an adopter) please document it as such. 

This is a regression that was the result of the fix for bug 341415.  There is a major loss of functionality as a result, largely that you cannot add mappings to the eclipselink-orm.xml mapping file.  This must be fixed for Indigo.

    Is there a work-around? If so, why do you believe the work-around is insufficient? 

Only workaround would be to disable EclispeLink support and manually write mapping file.

    How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added? 

The fix has been tested by Brian and myself.

    Give a brief technical overview. Who has reviewed this fix? 

See comment 2. I have reviewed the fix.  It is safe, simple, and effective.

    What is the risk associated with this fix? 

Very low risk.
Comment 4 Brian Vosburgh CLA 2011-05-25 17:53:47 EDT
Patch checked into HEAD.
Comment 5 Jolene Moffitt CLA 2011-06-28 11:25:38 EDT
Verified in Build I-3.3.0RC4-20110603221533

Verified you can add mappings to EL orm mapping file without error.  See the link to view test steps for verification. http://wiki.eclipse.org/Dali_3.0_RC3