what makes this stranger is it worked last week.  i can't think of anything
that changed since then that would affect this.

ok, on all of my transfer objects i override the tostring method to convert
my objects into xml strings.  jibx was applied to an existing system so this
is the only way i can make it work.  now heres my method.

@Override
public String toString()
{
SurveyName sname = this.getSurveyNames().get(0);
for (SurveyNameStore namestore : sname.getSurveyNameStores())
{
System.out.println("id of store " +
namestore.getShowStoreLocation().getStoreId() + " name of store:  "
+ namestore.getShowStoreLocation().getStoreName());
}

StringWriter stringWriter;
try
{
IBindingFactory bfact;
bfact = BindingDirectory.getFactory(AjaxResponseTO.class);
IMarshallingContext mctx = bfact.createMarshallingContext();
mctx.setIndent(2);
stringWriter = new StringWriter();
mctx.setOutput(stringWriter);
mctx.marshalDocument(this);
} catch (JiBXException e)
{
e.printStackTrace();
return null;
}

return stringWriter.toString();
}

now the loop at the beginning is a debugging thing i put in to try to figure
this out.  so, the debugging code indicates that in the surveyNameStore
class, there is a storeLocation record.  but when it runs thru the
marshalling, the surveyNameStore is there, but the storeLocation is blank.
 in my bindings i tried making the values of the storeLocation required and
i get null value errors because it sees the class as null.

why would code just before the marshalling context say a record is there,
but the marshalling context say its null?

here are my bindings.

<mapping name="AjaxResponseTO" class="com.show.comm.to.AjaxResponseTO">
<value name="Status" field="status"
deserializer="com.show.comm.enumerations.ShowhubTransStatus.xmlToEnum"/>
<value name="StatusMsg" field="statusMsg" usage="optional"/>
<collection name="SurveyNames" field="surveyNames"
item-type="com.show.comm.to.db.SurveyName" usage="optional"/>
<collection name="StoreLocations" field="storeLocations"
item-type="com.show.comm.to.db.StoreLocation" usage="optional">
<structure name="StoreLocation" map-as="StoreLocation" usage="optional" />
</collection>
</mapping>
 <mapping name="SurveyName" class="com.show.comm.to.db.SurveyName" >
<value name="IdShowSurveyName" field="idShowSurveyName" usage="optional"/>
<value name="Name" field="name" usage="optional"/>
<value name="StartDate" field="startDate" usage="optional"/>
<value name="EndDate" field="endDate" usage="optional"/>
<value name="Deleted" field="deleted" usage="optional"/>
<value name="SurveyLaunchLocation" field="surveyLaunchLocation"
usage="optional"/>
<value name="Optional" field="optional" usage="optional"/>
<collection name="SurveyNameStores" field="surveyNameStores"
item-type="com.show.comm.to.db.SurveyNameStore" usage="optional"/>
<collection name="SurveyQuestionses" field="surveyQuestionses"
item-type="com.show.comm.to.db.SurveyQuestions" usage="optional"/>
</mapping>
 <mapping name="SurveyNameStore" class="com.show.comm.to.db.SurveyNameStore"
>
<value name="idShowSurveyNameStore" field="idShowSurveyNameStore"
usage="optional"/>
<value name="IdSurveyname" field="idSurveyname" usage="optional"/>
<structure name="StoreLocation" field="showStoreLocation"
map-as="StoreLocation" />
</mapping>
 <mapping abstract="true" type-name="StoreLocation"
class="com.show.comm.to.db.StoreLocation" >
<value name="storeId" field="storeId"/>
<value name="storeName" field="storeName" usage="optional"/>
</mapping>

like i said, this worked a week ago and i don't understand what could have
changed between then and now.
-- 
You want it fast, cheap, or right.  Pick two!!
------------------------------------------------------------------------------
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to