hyperjaxb3 icon indicating copy to clipboard operation
hyperjaxb3 copied to clipboard

Set a jaxb:javaType to a part of composite keys make the IdClass attribute as String

Open trixprod opened this issue 9 years ago • 1 comments
trafficstars

Hello,

This is a strange behaviors with Hyperjaxb ( tested with 0.5.6 and latest ).

If i specify a javaType (with parse and print method) to an attribute which is a part a composite key, then hyperjaxb create an IdClass (ok, composed with all keys attributes) but with the attribute typed as String ( and not Date as the following example ).

<jaxb:bindings node="xsd:element[@name='timestamp']" multiple="true" required="false" >
    <jaxb:javaType name="java.util.Date"
    parseMethod="com.test.RFC2282DateAdapter.parseDate"
    printMethod="com.test.RFC2282DateAdapter.printDate"/>                  
</jaxb:bindings>

Results :

     @XmlAccessorType(XmlAccessType.FIELD)
    public static class TickerId {

        @XmlSchemaType(name = "dateTime")
        protected String timestamp; // Should be a Date there !!
        protected String currency; // Other part of the composite key, that's ok
        ...
   }

If i remove the binding an XMLGregorianCalendar is generated (i don't want this), moreover a parse exception is throwed. That's normal because the string date format found is not recognized as the standard date format.

trixprod avatar Mar 06 '16 10:03 trixprod

javaType adds adapters which are not correctly supported by HJ3. This is a limitation.

highsource avatar Mar 07 '16 11:03 highsource