Suppose we have some fancy class ThingFoo that you want to bind to a field, but you DONT want the binding
compiler to mess with its byte code (perhaps you want to use it in several independent binding files). So you wrap
access to an instance of ThingFoo in a containing class, ThingBar, by correctly defining set & get methods in your code:
class ThingBar {
private ThingFoo foo;
public ThingBar(){...}
void setFoo(String stringOfFoo) {...}
String getFoo(){...}
}Now JiBX will actually do different things with this depending on how you bind that field:
1.)
<value name="foo" field="foo" get-method="getFoo" set-method="setFoo"/>
This binding causes ClassCastExceptions for me. It seems to ignore the set and get methods.
2.) <value name="foo" get-method="getFoo" set-method="setFoo"/> Notice field="foo" is gone! This version works just fine. :-)
Perhaps there should be something in the parser to check for this? If your binding is as in the first case it should say
"field and set/get are mutually exclusive".
-- Gareth
HD wrote:
No... I'm not using any set methods... I am only using the field property in the bindings.
Here is the output of the compiler on my class:
[bind] mapping class com.actualis.sage.DocumentVte to element DocumentVte
[bind] element wrapper DocumentVte
[bind] object binding for com.actualis.sage.DocumentVte
[bind] structure ordered
[bind] element sync_state from optional property sync_state (int)
[bind] element UID from optional property UID (long)
[bind] element DO_Type from optional property DO_Type (int)
[bind] element DO_Piece from optional property DO_Piece (java.lang.String)
[bind] element DO_Date from optional property DO_Date (java.sql.Timestamp)
[bind] element DO_Ref from optional property DO_Ref (java.lang.String)
[bind] element DO_DateLivr from optional property DO_DateLivr (java.sql.Timestamp)
[bind] element DO_Tiers from optional property DO_Tiers (java.lang.String)
[bind] element DE_No from optional property DE_No (int)
[bind] element LI_No from optional property LI_No (long)
[bind] element lieu_livraison_tmp from optional property lieu_livraison_tmp (long)
[bind] element lieu_enlevement from optional property lieu_enlevement (long)
[bind] element DO_Period from optional property DO_Period (int)
[bind] element DO_Devise from optional property DO_Devise (int)
[bind] element DO_Cours from optional property DO_Cours (double)
[bind] element CT_NumPayeur from optional property CT_NumPayeur (java.lang.String)
[bind] element DO_Expedit from optional property DO_Expedit (int)
[bind] element DO_Condition from optional property DO_Condition (int)
[bind] element DO_Langue from optional property DO_Langue (int)
[bind] element RE_No from optional property RE_No (int)
[bind] element DO_Coord01 from optional property DO_Coord01 (java.lang.String)
[bind] element DO_Coord02 from optional property DO_Coord02 (java.lang.String)
[bind] element DO_Coord03 from optional property DO_Coord03 (java.lang.String)
[bind] element DO_Coord04 from optional property DO_Coord04 (java.lang.String)
[bind] element affaire from optional property affaire (java.lang.String)
[bind] element DO_Tarif from optional property DO_Tarif (int)
[bind] element DO_Regime from optional property DO_Regime (int)
[bind] element DO_Transaction from optional property DO_Transaction (int)
[bind] element DO_Colisage from optional property DO_Colisage (int)
[bind] element DO_TypeColis from optional property DO_TypeColis (int)
[bind] element nb_factures from optional property nb_factures (int)
[bind] element UnSeul_BL_Fac from optional property UnSeul_BL_Fac (boolean)
[bind] element DO_TxEscompte from optional property DO_TxEscompte (double)
[bind] element ecart_valorisation from optional property ecart_valorisation (double)
[bind] element N_CatCompta from optional property N_CatCompta (int)
[bind] element frais_ventile from optional property frais_ventile (boolean)
[bind] element DO_Statut from optional property DO_Statut (int)
[bind] element compte_general from optional property compte_general (java.lang.String)
[bind] element DO_Cloture from optional property DO_Cloture (boolean)
[bind] element id_cmd_inet from optional property id_cmd_inet (java.lang.String)
I was wondering if my bug would'nt be related to sql types like timestamps and dates. How is JiBX mapping them ?
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
-------------------------------------------------------
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
