Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 345036 - Two mappings shown up in the JAXB content for a field/property
Summary: Two mappings shown up in the JAXB content for a field/property
Status: CLOSED INVALID
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: JAXB (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: dali.general-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-06 17:08 EDT by Nan Li CLA
Modified: 2011-05-06 17:23 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nan Li CLA 2011-05-06 17:08:52 EDT
Build Identifier: I20110428-0848

Given a class like the one below:

@XmlAccessorType(XmlAccessType.PROPERTY) <--
@XmlType(name="test")
public class Test {

	@XmlAttribute    <--
	private int id;

	public int getId() {
	  return id;
	}

	public void setId(int id) {
	  this.id = id;
	}
}

If annotating a field (id in this example) with @XmlAttribtue or @XmlElement, you would get two mappings for that field in the JAXB content if not specifying @XmlAccessorType annotation or specifying the access type as PROPERTY with @XmlAccessorType(XmlAccessType.PROPERTY).

Reproducible: Always
Comment 1 Nan Li CLA 2011-05-06 17:23:59 EDT
OK. This is a valid case based on the spec. (8.12.5 Property / Field).