title: SimpleJdbcCall executeObject() usage in Spring Framework
body: <p>I usually do this in my repository package:</p>
  
  <pre><code>public void setDataSource(DataSource dataSource) {
      procGetDeviceDetails = new SimpleJdbcCall(dataSource)
          .withProcedureName("web_Device_Details")
          .returningResultSet("results", BeanPropertyRowMapper.newInstance(Device.class));
  }
  
  public Device deviceDetails(Map input) {
      Map m = procGetDeviceDetails.execute(input);
      List&lt;Device&gt; list = (List&lt;Device&gt;) m.get("results");
      if (list.size() &gt; 0) {
          return list.get(0);
      }
      return null;
  }
  </code></pre>
  
  <p>I wish to remove boilerplate in second method so I've switched to executeObject(). I tried this. Both failed.</p>
  
  <pre><code>public Device deviceDetails(Map input) {
      Device device = procGetDeviceDetails.executeObject(Device.class, input);
      return device;
  }
  
  public Device deviceDetails(Map input) {
      List&lt;Device&gt; device = procGetDeviceDetails.executeObject(List.class, input);
      return device.get(0);
  }
  </code></pre>
  
  <p>Problem is that my device is null. I tried also declaring just Object instead of Device or List and it's still null. What am I doing wrong?</p>
  
  <p>I know that result is correctly mapped into Device class because I see that procGetDeviceDetails (SimpleJdbcCall) has declaredRowParameters equal to {#result-set-1=org.springframework.jdbc.core.BeanPropertyRowMapper@79095fd7} and BeanPropertyRowMapper has mappedClass set to Device.</p>
  
  <p>Seems that generics or something else troubles me. I found example here. <a href="https://jira.spring.io/browse/SPR-7270" rel="nofollow">https://jira.spring.io/browse/SPR-7270</a></p>
  
  <p>Thanks!</p>