Hi,

Try changing your binding to:

  <mapping name="SalesOrder" class="company.orders.SalesOrderImpl" factory="
ObjectFactory.createSalesOrder" >



        <collection name="CustomFields" type="company.CustomField"
add-method="add" size-method="getCustomListSize" load-method="get"  />

        <structure name="Memos" />

        <structure name="SalesOrderItems" />

    </mapping>


-Brian




On Wed, Mar 12, 2008 at 9:28 AM, Keith Brown <
[EMAIL PROTECTED]> wrote:

>  I am having a problem binding this example.
>
>
>
> My class pretty scaled back:
>
>
>
> package comany.impl.orders;
>
>
>
> public class SalesOrderImpl extends BaseObject implements SalesOrder {
>
> ..
>
>
>
>     public void addCustomField(CustomField customField) {
>
>         customFields.add(customField);
>
>     }
>
>
>
>
>
>     public int getCustomListSize() {
>
>         return customFields.size();
>
>     }
>
>
>
>     public ArrayList<CustomField> getCustomFields() {
>
>         return customFields;
>
>     }
>
>     public void setCustomFields(ArrayList<CustomField> cFileds) {
>
>         customFields=cFileds;
>
>     }
>
>     public CustomField getCustomField(int index) {
>
>         return customFields.get(index);
>
>     }
>
>
>
> }
>
>
>
> package company.orders;
>
>
>
> public interface SalesOrder {
>
>
>
>     public ArrayList<CustomField> getCustomFields();
>
>
>
>     public void setCustomFields(ArrayList<CustomField> cFields);
>
>
>
>     public int getCustomListSize();
>
>
>
>     public CustomField getCustomField(int index);
>
>
>
>     public void addCustomField(CustomField customField);
>
>
>
> }
>
>
>
> XML scaled back:
>
>
>
> <SalesOrder>
>
> …
>
>   <CustomFields>
>
>             <CustomField>
>
>               <ID>44</ID>
>
>               <Type>Money</Type>
>
>               <Name>Name</Name>
>
>               <Description>Description</Description>
>
>               <SortOrder>4</SortOrder>
>
>               <Info>info</Info>
>
>               <RequiredFlag>true</RequiredFlag>
>
>               <ActiveFlag>true</ActiveFlag>
>
>     </CustomField>
>
>   </CustomFields>
>
>   <Memos/>
>
>   <SalesOrderItems/>
>
> </SalesOrder>
>
>
>
>
>
> Binding:
>
>
>
> <binding force-classes="true" >
>
>   <mapping name="SalesOrder" class="company.orders.SalesOrderImpl"
> factory=" ObjectFactory.createSalesOrder" >
>
>
>
>         <collection name="CustomFields" type="company.CustomField"
> add-method="addCustomField" size-method="getCustomListSize"
> load-method="getCustomField"  />
>
>         <structure name="Memos" />
>
>         <structure name="SalesOrderItems" />
>
>     </mapping>
>
>
>
>   <mapping name="CustomField" class="company.impl.CustomFieldImpl"
> factory=" ObjectFactory.createCustomField" >
>
>   <value name="ID" get-method="getID" set-method="setID" />
>
>   <value name="Type" get-method="getType" set-method="setType"/>
>
>   <value name="Name" get-method="getName" set-method="setName" />
>
>   <value name="Description" get-method="getDescription"
> set-method="setDescription" />
>
>   <structure  get-method="getCustomList" set-method="setCustomList" type="
> company.impl.CustomListImpl" />
>
> </mapping>
>
>
>
> </mapping>
>
>   <mapping name="CustomList" class="company.impl.CustomListImpl" factory="
> ObjectFactory.createCustomList" >
>
>     <value name="ID" get-method="getID" set-method="setID" />
>
>     <value name="Name" get-method="getName" set-method="setName" />
>
>     <collection name="CustomListItems" add-method="addCustomListItem"
> item-type="company.CustomListItem" size-method="getCustomListItemSize"
> load-method="getCustomListItem" />
>
>   </mapping>
>
>
>
> <mapping name="CustomListItem" class="company.impl.CustomListItemImpl"
> factory=" ObjectFactory.createCustomListItem" >
>
>   <value name="ID" get-method="getID" set-method="setID" />
>
>   <value name="Name" get-method="getName" set-method="setName" />
>
> </mapping>
>
>
>
> </binding>
>
>
>
>
>
> Now the errors that I am getting are:
>
>
>
> Error: add-method addCustomField not found in class company.CustomField;
> on collection element at (line 48, col 164, in orders-binding.xml)
>
> Error: load-method getCustomField not found in class company.CustomField;
> on collection element at (line 48, col 164, in orders-binding.xml)
>
> Error: References to structure object must have compatible types:
> company.impl.orders.SalesOrderImpl cannot be used as company.CustomField;
> on collection element at (line 48, col 164, in orders-binding.xml)
>
>
>
> Just looking for some ideas.  If I set the CustomField collection to be
> ignored like this <structure name="CustomFields" /> it works.  When I try to
> bind this collection I get the errors.  I am binding other collections in a
> similar method and those work fine.  For example the biding in CustomList
> that has a collection of CustomListItems works just fine.
>
>
>
> Any ideas what is going on or where I can look.
>
>
>
> Once again thank you for your help.  Getting much closer to being
> finished.
>
>
>
> Keith
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to