0 Replies Latest reply: Aug 21, 2007 5:20 AM by 807605 RSS

    JiBX Collection Problem

    807605
      Hi,

      I'm using the JiBX to bind the xml with java objects. But it comes out an error after i added the collection in.
           [bind] Error: Nonstatic field person not found in class java.lang.Object; on structure element at (line 4, col 46, in jibx-collection/binding.xml)
           [bind] Warning: Property access attributes (field, get-method, set-method, test-method) ignored for collection item; on structure element at (line 4, col 46, in jibx-collection/binding.xml)
      data.xml
      <customer>
        <person>
          <cust-num>123456789</cust-num>
          <first-name>John</first-name>
          <last-name>Smith</last-name>
        </person>
        <person>
          <cust-num>123456789</cust-num>
          <first-name>John</first-name>
          <last-name>Smith</last-name>
        </person>
      </customer>
      binding.xml
      It comes out with same error even i changed the person to Person.
      <binding>
        <mapping name="customer-profiles" class="org.jibx.starter.Customer">
             <collection field="customers">
               <structure name="person" field="person">
                 <value name="cust-num" field="customerNumber"/>
                 <value name="first-name" field="firstName"/>
                 <value name="last-name" field="lastName"/>
               </structure>
          </collection>
        </mapping>
      </binding>
      Customer.java
      package org.jibx.starter;
      import java.util.ArrayList;
      public class Customer {
         public ArrayList customers;
          public Person person;
      }
      Person.java
      package org.jibx.starter;
      public class Person {
          public int customerNumber;
          public String firstName;
          public String lastName;
      }
      Anyone have ideas on how to solve it? Your help will be much appreciates.
      Thanks