title: Getting a list of objects in Hibernate returns a list of a single object
body: <p>I am using Hibernate in my Spring Java EE application. I get the list of Users, where User is a bean specified in the applicationContext.xml as follows: </p>
  
  <pre><code>    &lt;property name="annotatedClasses"&gt;
          &lt;list&gt;
              &lt;value&gt;foo.bar.User&lt;/value&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  </code></pre>
  
  <p>The code that returns the list of users is the following; the returned list has the correct size, however all the objects seem to be the same object (I'm printing out the objects in my JSF file using ui:repeat.</p>
  
  <pre><code>public List&lt;User&gt; getAllUsers() {
  
      Query q = currentSession().createQuery("from User");
  
      List&lt;User&gt; allUsers = (List&lt;User&gt;) q.list();
  
      return allUsers;
  
  }
  </code></pre>
  
  <p>I suspect that the User is returned a single time, however cannot resolve the issue.</p>
  
  <p>How can I make a Hibernate query to return all objects?</p>