高分求教……org.hibernate.hql.ast.QuerySyntaxException:User is not mapped [from User]org.springframework.orm.hibernate3.HibernateQueryException:User is not mapped [from User]; nested exception is org.hibernate.hql.ast.QuerySyntaxException:User

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 06:18:29

高分求教……org.hibernate.hql.ast.QuerySyntaxException:User is not mapped [from User]org.springframework.orm.hibernate3.HibernateQueryException:User is not mapped [from User]; nested exception is org.hibernate.hql.ast.QuerySyntaxException:User
高分求教……org.hibernate.hql.ast.QuerySyntaxException:User is not mapped [from User]
org.springframework.orm.hibernate3.HibernateQueryException:User is not mapped [from User]; nested exception is org.hibernate.hql.ast.QuerySyntaxException:User is not mapped [from User]
org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:657)
org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:921)
org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:913)
com.test.model.UserAction.execute(UserAction.java:54)
……
beans.xml中是:
com.test.model
hibernate.dialect=org.hibernate.dialect.SQLServerDialect
hibernate.show_sql=true
hibernate.hbm2ddl.auto=update
struts.xml如下:
/success.jsp
/fail.jsp
……
.class类如下:
public String execute() throws Exception {
if(password.equals(password2)){
User user = new User();
user.setUsername(username);
user.setPassword(password);
hibernateTemplate.save(user);
return hibernateTemplate.find("from User").size()>0?"success":"fail";
}
return "fail";
}
不是我想写那么多,实在是没有办法了,第一次用struts2\hibernate\spring整合后出现的这个问题,我一整天了都没得解决,hibernateTemplate.save()可以,但hibernateTemplate.find()就不得了,把我的分拿去吧

高分求教……org.hibernate.hql.ast.QuerySyntaxException:User is not mapped [from User]org.springframework.orm.hibernate3.HibernateQueryException:User is not mapped [from User]; nested exception is org.hibernate.hql.ast.QuerySyntaxException:User




com.test.model




hibernate.dialect=org.hibernate.dialect.SQLServerDialect
hibernate.show_sql=true
hibernate.hbm2ddl.auto=update