title: How do I sort list with criteria in hibernate
body: <p>I am new to Spring3 and Hibernate the following code works great but I am trying to find a way to have my list returned in sort order by the date field. Can someone please show me how to add sort to this code</p>
  
  <pre><code>// To get list of all articles
  @SuppressWarnings("unchecked")
  public List&lt;Friend&gt; listFriends(String rUser) 
  {
     Friend friend = new Friend();
      friend.setUsername(rUser);
  
      return (List&lt;Friend&gt;) sessionFactory.getCurrentSession()
         .createCriteria(Friend.class)
          .add(Example.create(friend))
          .list();
  }
  </code></pre>