That should work fine, though it won't be schema-compatible (both in terms of formatting, and in terms of the actual value - schema would require it to be in UTC). My thought was to write Timestamps as basically extended java.util.Date values, with precision down to the nanosecond level. That'd take some refactoring of the org.jibx.runtime.Utility code to support, though.

 - Dennis

HD wrote:

No I did not extend the Utility (even if I had a look at it) because Java has special toString and valueOf methods for Timestamp. So I my serializer are just
public static String serializeTimestamp(Timestamp ts) {
return ts.toString(); }
public static Timestamp deserializeTimestamp(String text) {
if (text == null) return null;
return Timestamp.valueOf(text);
}


Henri.
Dennis Sosnoski dms-at-sosnoski.com |JiBX| wrote:

Thanks for tracking this down, Henri, and entering the bug report at http://jira.codehaus.org/browse/JIBX-29. It's fixed in the beta 3c release (in that trying to use java.sql.Timestamp without a custom serializer will cause an error at binding time). I also added automatic support for java.sql.Date (though I haven't tested this extensively).

Did you build your Timestamp handling by extending the existing code in org.jibx.runtime.Utility? I considered doing this for the beta 3c release, but it looked like it'd be more added work than I wanted to take on when I had things pretty much ready to go. java.sql.Time is the third type that would require special handling, and here again there's code that this could be based on already present in org.jibx.runtime.Utility.

 - Dennis

HD wrote:

I finally figured out that issue. I put all the info in the Jira. java.sql.Timestamps are serialized in java.util.Date (there seems to be somekind of test with instanceof java.util.Date) but then in the class, the fied is casted into java.util.Date which generates my issue.
I wrote my own serializer for java.sql.Timestamp which solved the problem!


Henri.

Dennis Sosnoski dms-at-sosnoski.com |JiBX| wrote:

It'd relate to the binding definitions for your DocumentVte class, of course. There's a known issue of this type in the Jira issue tracking system: http://jira.codehaus.org/browse/JIBX-3 Does that match what you're seeing?

 - Dennis

HD wrote:

I had this ClassCastException today. I have several similar bindings, the other ones worked except this one. All my fields are optional.
Any idea where I should look to solve this issue ?
22:48:52,954 ERROR LANGateway:138 - Erreur lors de l'execution
java.lang.ClassCastException
at com.actualis.sage.DocumentVte.JiBX_xml_bindings_unmarshal_2_0(DocumentVte.java)


at com.actualis.sage.JiBX_xml_bindingsDocumentVte_access.unmarshal()
at org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2568)


at com.actualis.sage.JiBX_MungeAdapter.JiBX_xml_bindings_unmarshal_1_0()
at com.actualis.sage.DocumentsVte.JiBX_xml_bindings_unmarshal_3_1(DocumentsVte.java)


at com.actualis.sage.JiBX_xml_bindingsDocumentsVte_access.unmarshal()
at org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2568)


at org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2736)

at com.actualis.ExportManager.readZipVector(ExportManager.java:162)
at com.actualis.SageDB.importFromFile(SageDB.java:144)
at com.actualis.sage.SageLANGateway.importFiles(SageLANGateway.java:118)
at com.actualis.sage.SageLANGateway.exec_imports(SageLANGateway.java:90)
at com.actualis.sage.SageLANGateway.start(SageLANGateway.java:50)
at com.actualis.LANGateway.exec(LANGateway.java:132)
at com.actualis.sage.SageLANGateway.main(SageLANGateway.java:132)





-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users


-- Dennis M. Sosnoski Enterprise Java, XML, and Web Services Training and Consulting http://www.sosnoski.com Redmond, WA 425.885.7197




-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to