title: Hibernate ClassCastException [myBean] incompatible with java.util.Map
body: <p>I've done this before. I'm even doing it in other places in the same application.  Hibernate 5.2 is my version. AssetInfo is a simple bean, just 4 columns. All properties have get/set. Null constructor. The query seems to be compiling. I double checked that all return columns are aliased to line up with the property names of the bean. No annotations on AssetInfo, it's just a bean.</p>
  <p>I must be missing something.  There must be something different about this vs other places in the same app I'm doing this, but I'm not seeing it. It seems to die after the query while prepping results for me.</p>
  <p>The exception:</p>
  <pre><code>java.lang.ClassCastException: [mypackage].AssetInfo incompatible with java.util.Map
  at org.hibernate.property.access.internal.PropertyAccessMapImpl$SetterImpl.set(PropertyAccessMapImpl.java:102) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
  at org.hibernate.transform.AliasToBeanResultTransformer.transformTuple(AliasToBeanResultTransformer.java:78) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
  at org.hibernate.hql.internal.HolderInstantiator.instantiate(HolderInstantiator.java:85) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
  at org.hibernate.loader.custom.CustomLoader.getResultList(CustomLoader.java:430) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
  at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2507) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
  at org.hibernate.loader.Loader.list(Loader.java:2502) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
  at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:335) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
  at org.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.java:2161) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
  at org.hibernate.internal.AbstractSharedSessionContract.list(AbstractSharedSessionContract.java:1016) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
  at org.hibernate.query.internal.NativeQueryImpl.doList(NativeQueryImpl.java:152) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
  at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1414) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
  </code></pre>
  <p>The call:</p>
  <pre><code>    Query&lt;AssetInfo&gt; query = session.createNativeQuery(sql.toString()).setResultTransformer(Transformers.aliasToBean(AssetInfo.class));
      buildParmList(query, searchCriteria);
      List&lt;AssetInfo&gt; result = query.list();
  </code></pre>
  <p>The query (as logged out by hibernate - showing it did compile and run it):</p>
  <pre><code>select asset_id as assetId, [redacted] as caseNumber, asset_desc as assetDescription, asset_val as assetValue from [redacted] where [redacted]= ? and  ASSET_ID like  '21-%' order by asset_id  fetch first 100 rows only
  </code></pre>
  <p>The bean:</p>
  <pre><code>private String assetId;
  private String assetDescription;
  private BigDecimal assetValue;
  private String caseNumber;
  
  public AssetInfo() {
      super();
  }
  
  public String getCaseNumber() {
      return caseNumber;
  }
  public void setCaseNumber(String caseNumber) {
      this.caseNumber = caseNumber;
  }
  public BigDecimal getAssetValue() {
      return assetValue;
  }
  public void setAssetValue(BigDecimal assetValue) {
      this.assetValue = assetValue;
  }
  public String getAssetId() { 
      return assetId;
  }
  public void setAssetId(String assetId) {
      this.assetId = assetId;
  }
  public String getAssetDescription() {
      return assetDescription;
  }
  public void setAssetDescription(String assetDescription) {
      this.assetDescription = assetDescription;
  }
  </code></pre>