org.glassfish.jaxb.runtime.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions. Si une classe comporte la propriété @XmlElement, elle ne peut pas comporter la propriété @XmlValue.
import jakarta.xml.bind.annotation.*;
import jakarta.persistence.*;
@Entity
@XmlAccessorType(XmlAccessType.FIELD)
public class Objectif {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
//@XmlValue à corriger
@Column(name = "value")
@XmlValue
private String value;
@XmlAttribute(name = "statut", required = true)
@Column(name = "statut")
private String statut;
@ManyToOne
@JoinColumn(name = "cv24_id")
private CV24 cv24;
/**
* @return the value
*/
public String getValue() {
return value;
}
/**
* @param value the value to set
*/
public void setValue(String value) {
this.value = value;
}
/**
* @return the statut
*/
public String getStatut() {
return statut;
}
/**
* @param statut the statut to set
*/
public void setStatut(String statut) {
this.statut = statut;
}
}
Lorsque j'assais de faire des insertions dans ma base de données, j'obtiens l'erreur signifiée en entête du proble.
Voici les flux xml que je veux réaliser
<objectif statut="Stage">Dev</objectif>
I think you should add the @XmlTransient
to any fields that are not needed in your XML representation (such as id
and cv24
fields).
By default, using @XmlAccessorType(XmlAccessType.FIELD)
will make :
Every non static, non transient field in a Jakarta XML Binding-bound class will be automatically bound to XML, unless annotated by XmlTransient. Getter/setter pairs are bound to XML only when they are explicitly annotated by some of the Jakarta XML Binding annotations.