title: Spring HibernateTemplate - is contain / find / get value by class name & non-ID-param
body: <p>For refrence look <a href="http://singgihpraditya.wordpress.com/2010/02/13/spring-3-0-and-hibernate-tutorial-part-1/" rel="nofollow">http://singgihpraditya.wordpress.com/2010/02/13/spring-3-0-and-hibernate-tutorial-part-1/</a> </p>
  
  <pre><code>@Entity
  @Table(name="USER")
  public class User implements Serializable {
          private Long id;
      private String name;
  private String password;
  
  @Id
  @GeneratedValue
  @Column(name="USER_ID")
  public Long getId() {
      return id;
  }
  public void setId(Long id) {
      this.id = id;
  }
  
      private HibernateTemplate hibernateTemplate;
  
      @Autowired
      public void setSessionFactory(SessionFactory sessionFactory) {
          this.hibernateTemplate = new HibernateTemplate(sessionFactory);
      }
  </code></pre>
  
  <p>the above part is code from 2 files , just to give you some code as people here like to ask for it <P>
  the important part:</p>
  
  <pre><code>@Override
  public User getUser(Long id) {
      return hibernateTemplate.get(User.class, id);
  
  }
  </code></pre>
  
  <p>As we can see get User by his ID is easy..
  I want to  :  i'm sure its easy I just dont know how , and I know there is the alternative way to get all User into a a <code>List&lt;User&gt;</code> and serach with <code>for(..)</code> but I don't want that way, I want the elegant way.
  <P>
  * return user by name
  <p>
  * return true/false if user exists by name
  <P></p>