I have this Entity class:
package com.model;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity
import com.model.BaseEntity;
import com.model.CustomerPK;
@Entity
@Table(name = "CUSTOMER")
public class Customer extends BaseEntity {
private static final long serialVersionUID = -625869124375935833L;
@EmbeddedId
private CustomerPK id;
@Column(name = "NAME", length = 70, nullable = true)
private String name;
@Column(name = "PHONE", length = 20, nullable = true)
private String phone;
@Column(name = "ADDRESS", length = 40, nullable = true)
private String address;
@Column(name = "CITY", length = 30, nullable = true)
private String city;
....
}
And I have this Web Service class:
package com.ws;
import javax.inject.Inject;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlElement;
import com.servico.WSService;
import com.model.Customer;
@WebService(serviceName = "customerWS")
public class CustomerWS {
@Inject
private WSService wss;
@WebMethod(operationName = "validateCustomer")
public List<String> validateCustomer(
@XmlElement(name = "customer", required = true) Customer customer) {
return wss.validateCustomer(customer);
}
}
When I try to start the service this error is shown:
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
Two classes have the same XML type name "{http://--.--.-----.-----.-----.----.----.--/}baseEntity". Use @XmlType.name and @XmlType.namespace to assign different names to them.
this problem is related to the following location:
at ------.BaseEntity
at ------.model.BaseEntity
this problem is related to the following location:
at ------.model.BaseEntity
I cannot edit the BaseEntity class. Is there a way to create the Web Service without annotate the BaseEntity class?
EDIT:
I don't want to use MOXy framework because I already have the Web Service online. My througs is if I can marshaller only the Customer class, without her BaseEntity class. Additional info: My client and my Web Service have access to the same package where Customer class is located.