arg20
arg20

Reputation: 4991

JAXB ignoring XmlElement directives

I have a problem generating the schema for a class I have. What I have is:

@XmlRootElement

@XmlAccessorType(XmlAccessType.FIELD)

public Class User {

....

@XmlElement(required = true)

protected String name;

....

}

Now, when I generate the schema using schemagen the line refering to that attribute is:

<xs:element name="name" type="xs:string"/>

the minOcurrences attribute is missing, I don't know why it ignores the annotation, any help is greatly appreciated. Also on a separate and unrelated topic, why does schemagen complaint when my class is anotated with JPA annotations? Is there any workaround for this?

Upvotes: 2

Views: 649

Answers (1)

arg20
arg20

Reputation: 4991

Sorry, how stupid of me, the default value for minOccur is 1.

Upvotes: 3

Related Questions