title: Hibernate Query.list returns actual Object instance instead of expected type
body: <p>When performing a hibernate query in HQL using a join and subsequently calling <code>query.list</code> to return the list of matched objects, I am ending up with a list of actual Object instances (i.e. <code>query.list().get(0).getClass() == Object.getClass()</code>) instead of instances of the expected object.</p>
  
  <p>Running the query without the join returns objects of the expected type correctly and they can be cast and used appropriately.</p>
  
  <p>So far my searches have not turned up anything about what could be causing this.  Is there something else I need to do when using a join in hql to ensure the object is mapped correctly?</p>
  
  <p>Edit: Added code excerpts below.  I had to change all the names and attempt to extract only the relevant portions (the real code is not really about cars).</p>
  
  <p>Working query:</p>
  
  <pre><code>from Car car where car.name like :name
  </code></pre>
  
  <p>Non-working query:</p>
  
  <pre><code>from Car car left join car.occupants occupant where car.name like :name OR (occupant.name like :oname)
  </code></pre>
  
  <p>Car entity:</p>
  
  <pre><code>@Entity
  @Table(uniqueConstraints = {@UniqueConstraint(columnNames = {"someId"}), 
                              @UniqueConstraint(columnNames = {"someOtherId"})})
  public class Car extends SomeParentEntity
  {
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private Long id;
  
      @Column(nullable = false, length = 64)
      private String someId;
  
      @Column(length = 64)
      private String name;
  
      // ... Many columns and mappings removed ...
  
      @OneToMany(mappedBy = "car", fetch = FetchType.LAZY)
      private List&lt;Occupant&gt; occupants;
  
      // ...
  }
  </code></pre>
  
  <p>Occupant entity:</p>
  
  <pre><code>@Entity(name = "car.Occupant")
  @Table(uniqueConstraints = {@UniqueConstraint(columnNames = { "name" }) })
  public class User extends SomeParentEntity
  {
  
      @ManyToOne
      @JoinColumn(name = "carId", nullable = false)
      private Car car;
  
      @Column(length = 64, nullable = false)
      private String name;
  
          // ... Many mappings / columns removed ...
  }
  </code></pre>