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

Bug 365614

Summary: Unnecessary exception thrown when both field and corresponding property are marked with @XmlTransient
Product: z_Archived Reporter: Blaise Doughan <blaise.doughan>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: denise.mahar, karenfbutzke, rick.barkhouse
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch - code changes - 2.3
none
Patch - code changes - 2.3
none
Patch - test changes - 2.3
none
Additional patch for class-level XmlTransient none

Description Blaise Doughan CLA 2011-12-05 10:22:40 EST
Currently with the following object model, MOXy is throwing an exception that the domain object has two mapped properties of the same name, when in reality neither of them are mapped since they are @XmlTransient:

public class Foo {

    @XmlTransient
    private String bar;

    @XmlTransient
    public String getBar() {
        return bar;
    }

    public woid setBar(String bar) {
        this.bar = bar;
    }

}

Workaround:

Annotate just the field or property (not both) as is appropriate for the specified accessor type.
Comment 1 Rick Barkhouse CLA 2012-03-20 13:39:51 EDT
Created attachment 212935 [details]
Patch - code changes - 2.3
Comment 2 Rick Barkhouse CLA 2012-03-20 15:56:04 EDT
Created attachment 212946 [details]
Patch - code changes - 2.3
Comment 3 Rick Barkhouse CLA 2012-03-20 15:56:19 EDT
Created attachment 212947 [details]
Patch - test changes - 2.3
Comment 4 Rick Barkhouse CLA 2012-03-20 15:57:01 EDT
*** Bug 363523 has been marked as a duplicate of this bug. ***
Comment 5 Rick Barkhouse CLA 2012-03-21 10:06:09 EDT
Fixed and checked in to 2.3 and trunk.  Reviewed by bdoughan.
Comment 6 Rick Barkhouse CLA 2012-03-26 15:48:14 EDT
Reopening this bug as it is causing another problem with XmlTransient / propOrder.

The following class will give an "XmlTransient in prop order" error:

@XmlTransient
@XmlRootElement        
@XmlType(name="",propOrder={"s001" , "b001"})
public class TestClass {
    
    private String   s001;
    private boolean b001;

    public TestClass() {}

    public String getS001() {
        return s001;
    }

    public void setS001(String s001) {
        this.s001 = s001;
    }

    public boolean isB001() {
        return b001;
    }

    public void setB001(boolean b001) {
        this.b001 = b001;
    }
    
}
Comment 7 Rick Barkhouse CLA 2012-03-27 12:49:03 EDT
Created attachment 213244 [details]
Additional patch for class-level XmlTransient
Comment 8 Denise Smith CLA 2012-03-28 09:40:34 EDT
Updated to ignore check when Class is Transient as shown in the Additional patch.
Comment 9 Eclipse Webmaster CLA 2022-06-09 10:23:50 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink