@OverridepublicSysUserfindUserByLoginName(StringpLoginName){Stringhql="from SysUser as u where u.loginName = ?";List<SysUser>users=getHibernateTemplate().find(hql,pLoginName);returnusers.isEmpty()?null:users.get(0);}
2. SQL(Structured Query Language)
1
2
3
4
5
6
7
8
staticListsql(){Sessions=HibernateUtil.getSession();Queryq=s.createSQLQuery("select * from user").addEntity(User.class);List<User>rs=q.list();s.close();returnrs;}