Hello people! hope everybody is cool.I've been trying to do something with spring-hibernate but it's still a failure.i'm very new to it.i need a little help.supposing a POJO class Users.i want to return an Users object by username.While i had no problem to return Users object by id by doing this
return (Users) getHibernateTemplate().get(Users.class, id);
it seems to be a challenge for me getting the Users object by username. I've tried this
List<Users> users = getHibernateTemplate().find("from Users u where u.username=?",username);
return users.get(0);
and even this
return (Users)getHibernateTemplate().find("from Users u where u.username=?",username).get(0);
how should i do it.And what is the proper way to return an array of Users objects and/or List.Thanks for reading this.