title: "IllegalArgumentException occurred while calling setter for property" from sqlserver numeric to java object
body: <p>I already have such an error, when you try to perform unapropriate matching (date to boolean, and so) which I had been able to fix quite easilly.</p>
  
  <p>But this time, I am quite confused, because hibernate refuses to match a "numeric" Id to a Java "Long" (and it also failed when setter is made for Double, Integer, Float, String, int, long, etc.) </p>
  
  <p>The sql-server field "id" is a <em>NUMERIC(19,0)</em></p>
  
  <p><strong>My DTO is :</strong></p>
  
  <pre><code>@XmlRootElement
  @XmlAccessorType(XmlAccessType.PROPERTY)
  public class DtoResult {
  
  private Long id;
  private String name;
  // ...
  
  
  public Long getId() {
      return id;
  }
  public void setId(final Long id) {
      this.id = id;
  }   
  public String getName() {
      return name;
  }
  public void setName(final String name) {
      this.name = name;
  }
  }
  </code></pre>
  
  <p>My hibernate query : </p>
  
  <pre><code>    final SQLQuery query= getCurrentSession().createSQLQuery(select + from + where);
  
      query.setParameter("manyFields", manyFields);
          query
          .addScalar("id")
          .addScalar("name")
          .setResultTransformer(Transformers.aliasToBean(DtoResult.class));
  
      return query.list(); // List&lt;DtoResult&gt;
  </code></pre>
  
  <p><strong>Error:</strong></p>
  
  <pre><code>IllegalArgumentException  occurred while calling setter for property [com.some.thing.DtoResult.id (expected type = java.lang.Long)]; target = [com.some.thing.DtoResult@77a70b79], property value = [269895]
  </code></pre>
  
  <p>I am really puzzled about this, thus any help is welcome.</p>
  
  <p>Thanks for reading untill there.</p>