主题:关于SSH中hibernate问题求助,大侠们帮帮忙吧
/**
* 根据用户名,密码查找用户
* @param username 查询所需的用户名
* @param pass 查询所需的密码
* @return 对应的用户
*/
public User findUserByNameAndPass(String username , String password)
{
String[] args={username,password};
List ul = getHibernateTemplate().find("from User au where au.username = ? and au.password= ?" , args);
if (ul.size() == 1)
{
return (User)ul.get(0);
}
return null;
* 根据用户名,密码查找用户
* @param username 查询所需的用户名
* @param pass 查询所需的密码
* @return 对应的用户
*/
public User findUserByNameAndPass(String username , String password)
{
String[] args={username,password};
List ul = getHibernateTemplate().find("from User au where au.username = ? and au.password= ?" , args);
if (ul.size() == 1)
{
return (User)ul.get(0);
}
return null;
}
以上是我dao里面的代码
数据库为sql server 2005
运行提示错误could not execute query; SQL [select user0_.id as id0_, user0_.username as username0_, user0_.password as password0_ from dbo.user user0_ where user0_.username=?]; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query