I have a library of JAXB/Entity objects I am using to unmarshall a xml stream. I can do so with no problems just running as a Java SE application. I have moved everything over to a Java EE app using Netbeans 6.9 and Glassfish 3.01. I am now running into a number of exceptions like the following.
com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 19 counts of IllegalAnnotationExceptions
Property _persistence_productBase_vh is present but not specified in @XmlType.propOrder
this problem is related to the following location:
at protected org.eclipse.persistence.indirection.WeavedAttributeValueHolderInterface entitiesjaxb.cmic.ajrs.com.ProductSorts._persistence_productBase_vh
at entitiesjaxb.cmic.ajrs.com.ProductSorts
at public entitiesjaxb.cmic.ajrs.com.ProductSorts entitiesjaxb.cmic.ajrs.com.ObjectFactory.createProductSorts()
at entitiesjaxb.cmic.ajrs.com.ObjectFactory
My problem is that there is no xml element or variable _persistence_productBase_vh anywhere in my enties/jaxb files. I assume this is being added by Glassfish and EclipseLink. Does anyone know any way to make these properties ignored? Here is the entity and a sample from the xml.
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ProductSorts", propOrder = {
"pkId",
"productBase",
"field",
"value",
"ts"
})
@Entity
@Table(name = "product_sorts")
@NamedQueries({
//@NamedQuery(name = "ProductSorts.findAll", query = "SELECT p FROM ProductSorts p"),
@NamedQuery(name = "ProductSorts.findByPkId", query = "SELECT p FROM ProductSorts p WHERE p.pkId = :pkId"),
@NamedQuery(name = "ProductSorts.findByField", query = "SELECT p FROM ProductSorts p WHERE p.field = :field"),
@NamedQuery(name = "ProductSorts.findByValue", query = "SELECT p FROM ProductSorts p WHERE p.value = :value"),
@NamedQuery(name = "ProductSorts.findByTs", query = "SELECT p FROM ProductSorts p WHERE p.ts = :ts")})
public class ProductSorts implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@Column(name = "pk_id")
private Integer pkId;
@Column(name = "field")
@XmlElement(name = "Field")
private String field;
@Column(name = "value")
@XmlElement(name = "Value")
private String value;
@Basic(optional = false)
@Column(name = "ts")
@Temporal(TemporalType.TIMESTAMP)
@XmlElement(required = true)
@XmlSchemaType(name = "dateTime")
private Date ts;
@JoinColumn(name = "pk_product", referencedColumnName = "pk_id")
@ManyToOne(fetch = FetchType.LAZY)
private ProductBase productBase;
public ProductSorts() {
}
public ProductSorts(Integer pkId) {
this.pkId = pkId;
}
<ProductSorts>
<pkID>317926</pkID>
<pkProduct>118647</pkProduct>
<Field>3D TECHNOLOGY</Field>
<Value>No</Value>
<ts>1970-01-13T00:43:15.947</ts>
</ProductSorts>
This property (_persistence_productBase_vh) has been woven onto the JPA entity. You can use property access in your JAXB mappings to get around this issue.
When EclipseLink does bytecode weaving it checks for JAXB on the classpath. If JAXB is present it will weave that property with the @XmlTransient annotation. Are you using static or dynamic weaving? If you are using static weaving you will need to ensure that the JAXB API jar is on your class path.