大家好我有Hibernate类,如下所示:
pageId
1. POJO名称:用户
2. Oracle表:tuser(因为如果给出名称"我有错误;用户"作为表名)
此处为服务:
@NamedQueries({
@NamedQuery(name = "getUser", query = "from tuser u where u.username =:username and u.passwordHash = :password"),
@NamedQuery(name = "getUserId", query = "select u.id from tuser u where u.username =:username"),
@NamedQuery(name = "getAllUsers", query = "from tuser u where u.state='1'"),
@NamedQuery(name = "loadUser", query = "from tuser u where u.username =:username"),
@NamedQuery(name = "changeState",query="update tuser u SET u.state='0' where u.id=:id")
})
@Entity
@Table(name = "tuser", catalog = "apw", uniqueConstraints = {
@UniqueConstraint(columnNames = "username"),
@UniqueConstraint(columnNames = "email") })
public class User implements java.io.Serializable {
}
当我运行程序时显示如下错误:
public interface UserService extends GenericService<User> {
public void deleteUser(int id);
public User loadUser(String username);
public List<User> getAllUsers();
User getUser(String username,String password);
}
&LT;&LT;&LT;对于getAllUsers,deleteUser,getUser&gt;&gt;&gt;
也是如此
最后,我的问题是如何将@NamedQuery映射到tuser Oracle表?
谢谢你,我很抱歉英语不好。