title: hibernate.QueryException: could not resolve property
body: <p>Here is another case of this ERROR:</p>
  
  <pre><code>21:22:15,881 ERROR [SessionFactoryImpl] Error in named query: ch.software.gvs.TroubleNotification_DeviceType.byType org.hibernate.QueryException: 
  could not resolve property: type of: ch.ildsoftware.gvs.TroubleNotification_DeviceType
  [select d.id from ch.ildsoftware.gvs.TroubleNotification_DeviceType d where d.type = :type]
  </code></pre>
  
  <p>I have following setting:</p>
  
  <p>queries.xml:</p>
  
  <pre><code>&lt;named-query name="ch.ildsoftware.gvs.TroubleNotification_DeviceType.byType"&gt;
      &lt;query&gt;
      select t.id from TroubleNotification_DeviceType t where t.type = :type
      &lt;/query&gt;        
  &lt;/named-query&gt;
  </code></pre>
  
  <p>TroubleNotification_DeviceType.java</p>
  
  <pre><code>import java.io.Serializable;
  
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.FetchType;
  import javax.persistence.Id;
  import javax.persistence.JoinColumn;
  import javax.persistence.ManyToOne;
  import javax.persistence.Table;
  
  @Entity
  @Table(name = "tblgwTroubleNotification_ADSTyp")
  public class TroubleNotification_DeviceType implements Serializable {
  
  private static final long serialVersionUID = 1L;
  
  private TroubleNotification id;
  private DeviceType type;
  private String createdBy;
  private String createdDate;
  
  public TroubleNotification_DeviceType() 
  {}
  
  public TroubleNotification_DeviceType(TroubleNotification id, DeviceType type) {
      this.id = id;
      this.type = type;
  }
  
  @Id
  @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "IDgwTroubleNotification", nullable = false)
  public TroubleNotification getId() {
      return id;
  }
  
  public void setId(TroubleNotification id) {
      this.id = id;
  }
  
  @Id
  @Column(name = "ADSTypID", nullable = false)
  @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "GeraeteTypID", nullable = false)
  public DeviceType getType() {
      return type;
  }
  
  public void setType(DeviceType type) {
      this.type = type;
  }
  
  @Column(name = "Created", nullable = false)
  public String getCreatedBy() {
      return createdBy;
  }
  
  public void setCreatedBy(String createdBy) {
      this.createdBy = createdBy;
  }
  
  @Column(name = "CreatedDate", nullable = false)
  public String getCreatedDate() {
      return createdDate;
  }
  
  public void setCreatedDate(String createdDate) {
      this.createdDate = createdDate;
  }
  }
  </code></pre>
  
  <p>I suspect there might be something wrong with the @Column and @JoinColumn annotation. It's just that the column-name I join with, is from a view which aliases the column name.
  But maybe something else is wrong. I'm rather new to this.</p>
  
  <p>snippet out of DeviceType:</p>
  
  <pre><code>private static final long serialVersionUID = 1L;
  private Integer id;
  private String name;
  
      ....
  
  @Id
  @Column(name = "GeraeteTypID", nullable = false)
  public Integer getId()
  {
      return this.id;
  }
  </code></pre>
  
  <p>In other classes the reference would be like this, and work well (yet the column name is identical):</p>
  
  <pre><code>@ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "GeraeteTypID", nullable = false)
  public DeviceType getType()
  {
      return this.type;
  }
  </code></pre>
  
  <p>snippet out of an EJB:</p>
  
  <pre><code>@Override
  @SuppressWarnings("unchecked")
  public List&lt;TroubleNotification&gt; getTroubleNotificationByDeviceType(DeviceType aType)
  {
      // first get all IDgwTroubleNotification for ADSTypID
      Query idSet = gvsData.createNamedQuery(
              TroubleNotification_DeviceType.class.getName() + ".byType");
      idSet.setParameter("type", aType);
      List&lt;TroubleNotification&gt; idSetResult = idSet.getResultList();
  
      final List&lt;TroubleNotification&gt; troubleNotificationResult = new ArrayList&lt;TroubleNotification&gt;();
      for (int i = 0; i &lt;  idSetResult.size(); i++) {
          // get all Notification for IDgwTroubleNotification
          Query notificationById = gvsData.createNamedQuery(
                  TroubleNotification.class.getName() + ".byId");
          notificationById.setParameter("id", idSetResult.get(i));
          troubleNotificationResult.add((TroubleNotification) notificationById.getResultList());
      }
      return troubleNotificationResult;
  }
  </code></pre>
  
  <p>Thank you for your help!</p>