title: Class has two properties of the same name
body: <p>I have two classes. Now I have database access and want to get Lead value. Using Spring REST + JDBC.</p>
  
  <pre><code>@XmlRootElement(name="newlead")
  public class NewLead {
  
       private String FIRSTNAME;
  
       private int LEADID;
  
       public String getFIRSTNAME() {
           return FIRSTNAME;
       }
  
       public void setFIRSTNAME(String FIRSTNAME) {
           this.FIRSTNAME = FIRSTNAME;
       }
  
       public int getLEADID() {
           return LEADID;
       }
  
       public void setLEADID(int LEADID) {
           this.LEADID = LEADID;
       }
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>@XmlRootElement(name="newLeads")
  public class NewLeadList {
  
      @XmlElement(required = true)
      public List&lt;NewLead&gt; allLeads = new ArrayList&lt;NewLead&gt;();
  
      @XmlElement(required = false)
      public List&lt;NewLead&gt; getData() {
          return allLeads;
      }
  
      public void setData(List&lt;NewLead&gt; data) {
          this.allLeads = data;
      }
  }
  </code></pre>
  
  <p>My controller</p>
  
  <pre><code>@Controller                 // Will be detected by &lt;context:component-scan&gt;
  @RequestMapping("/lead")    // Will be detected by &lt;mvc:annotation-driven&gt; (more specifically by one of its component - RequestMappingHandlerMapping)
  public class LeadController {
  
       @Resource(name="newLeadService")
       private com.varazo.service.NewLeadService newLeadService;
  
      // This method should be called for requests to "/"  
       @RequestMapping(value = "/newLeads", method = RequestMethod.GET, headers="Accept=application/xml,application/json")
       public @ResponseBody NewLeadList getNewLead() {
           // Call service here
           NewLeadList result = new NewLeadList();
           result.setData(newLeadService.getAll());
           System.out.println("*********************LeadController Retrieving all persons ***"+result+"***yes*************"); 
           return result;
       }
  </code></pre>
  
  <p>I am getting xml like</p>
  
  <pre><code>&lt;/allLeads&gt;
  &lt;allLeads&gt;
  &lt;LEADID&gt;0&lt;/LEADID&gt;
  &lt;/allLeads&gt;
  &lt;allLeads&gt;
  &lt;LEADID&gt;0&lt;/LEADID&gt;
  &lt;/allLeads&gt;
  &lt;allLeads&gt;
  &lt;LEADID&gt;0&lt;/LEADID&gt;
  &lt;/allLeads&gt;
  &lt;allLeads&gt;
  &lt;LEADID&gt;0&lt;/LEADID&gt;
  &lt;/allLeads&gt;
  &lt;data&gt;
  &lt;LEADID&gt;0&lt;/LEADID&gt;
  &lt;/data&gt;
  &lt;data&gt;
  &lt;LEADID&gt;0&lt;/LEADID&gt;
  &lt;/data&gt;
  &lt;data&gt;
  &lt;LEADID&gt;0&lt;/LEADID&gt;
  &lt;/data&gt;
  &lt;data&gt;
  </code></pre>
  
  <p>But I need each Lead value with firstname and id values. What is the problem here?</p>