4 Replies Latest reply: Jun 2, 2010 1:08 PM by Alexey Loubyansky RSS

Mapping xsd:dateTime to XMLGregorianCalendar

jaikiran pai Master

I am trying to map a xsd:dateTime to the (default) javax.xml.datatype.XMLGregorianCalendar in my binding class:

 

@XmlType(name = "timerType", propOrder =
{"descriptionGroup", "schedule", "start", "end", "timeoutMethod", "persistent", "timezone", "info"})
public class TimerMetaData extends IdMetaDataImplWithDescriptionGroup implements Serializable
{

   private ScheduleMetaData schedule;

   private XMLGregorianCalendar start;

...

 

 

However, JBossXB throws this error for the binding class:

 

Caused by: org.jboss.xb.binding.JBossXBRuntimeException: Property order is not specified for type javax.xml.datatype.XMLGregorianCalendar bound to a sequence. Property order can be specified using @XmlType.propOrder or @XmlAccessorOrder. List of properties: valid second hour minute fractionalSecond timezone eonAndYear millisecond month year XMLSchemaType day eon
at org.jboss.metadata.ejb.spec.TimerMetaData.start
at org.jboss.metadata.ejb.spec.SessionBean31MetaData.timer
at org.jboss.metadata.ejb.spec.EjbJar31MetaData.enterpriseBeans
at org.jboss.metadata.ejb.spec.EjbJar31MetaData
    at org.jboss.xb.builder.JBossXBNoSchemaBuilder.rethrowWithLocation(JBossXBNoSchemaBuilder.java:2018)
    at org.jboss.xb.builder.JBossXBNoSchemaBuilder.createRootElementBinding(JBossXBNoSchemaBuilder.java:346)
    at org.jboss.xb.builder.JBossXBNoSchemaBuilder.createRootElements(JBossXBNoSchemaBuilder.java:321)
    at org.jboss.xb.builder.JBossXBNoSchemaBuilder.build(JBossXBNoSchemaBuilder.java:232)
    at org.jboss.xb.builder.JBossXBBuilder.build(JBossXBBuilder.java:291)
    at org.jboss.xb.builder.JBossXBBuilder.build(JBossXBBuilder.java:181)
    at org.jboss.xb.builder.JBossXBBuilder.build(JBossXBBuilder.java:160)
    at org.jboss.xb.binding.resolver.AbstractMutableSchemaResolver.resolve(AbstractMutableSchemaResolver.java:313)
    at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:277)
    at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.startElement(SaxJBossXBParser.java:401)
    at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
    at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown Source)
    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
    at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:173)
    ... 29 more

 

 

Why do I have to explicitly specify a prop order on an element which I don't define (i.e. the javax.xml.datatype.XMLGregorianCalendar)? Any way to get around this?