wood burning stoves*
The moose likes XML and Related Technologies and the fly likes JAXB annotation error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "JAXB annotation error" Watch "JAXB annotation error" New topic
Author

JAXB annotation error

Ranadhir Nag
Ranch Hand

Joined: Mar 09, 2006
Posts: 138
I try to add the following annotation to the object tree created through xjc.

@XmlRootElement
public abstract class Customer {

// ======================================
// = Attributes =
// ======================================
@XmlAttribute
protected Long id;
protected String telephone;
protected String email;
protected Address homeAddress;
@XmlElementWrapper(name = "delivery")
@XmlElement(name = "address")
protected List<Address> deliveryAddresses = new ArrayList<Address>();

// ======================================
// = Getters & Setters =
// ======================================
public Long getId() {
return id;
}
........................
........................


I get a annotation error in compilation:

=====================================================================com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnn
tationExceptions
Class has two properties of the same name "deliveryAddresses"
this problem is related to the following location:
at public java.util.List customer.Customer.getDeliveryAddresses
)
at customer.Customer
this problem is related to the following location:
at protected java.util.List customer.Customer.deliveryAddresses
at customer.Customer
Class has two properties of the same name "id"
this problem is related to the following location:
at public java.lang.Long customer.Customer.getId()
at customer.Customer
this problem is related to the following location:
at protected java.lang.Long customer.Customer.id
at customer.Customer

===========================

What is the mistake I am committing?
I am using JAXB 2.0
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JAXB annotation error
 
Similar Threads
JAXB annotation problem/question
update while doing save in hibernate
More fun with JAXB, trying to implement Oasis WSN top down - errors genned
many-to-one relationship to non-PK field
Lazy loading not working as expected