Possible Duplicate:
XJC Generating Integer Instead of int
Need to generate entity class with primirive int field. But xml string like this
<xs:element name="RetriesCount" type="xs:int" minOccurs="0" default="2"/>
generates class with Integer filed named ‘retriesCount’. Using xs:integer causes generation with BigInteger type of ‘retriesCount’ field. Is there any solution to generate a simple Java int?
Because your schema says
minOccurs="0", JAXB has to use a type that is able to represent anullvalue, which is why it usesInteger. If you can change the schema tominOccurs="1"it will be able to useintinstead.Note that the
default="2"doesn’t necessarily do what you expect in XML. In particular the bound property will only take the default value if there is aRetriesCountelement specified, but that element has no value (i.e.<RetriesCount />or equivalently<RetriesCount></RetriesCount>). If theRetriesCountelement is completely absent the property value will benull.