org.hibernate.hql.ast.QuerySyntaxException:3QException in thread "main" org.hibernate.hql.ast.QuerySyntaxException:news is not mapped [from news] 一直是这个错误,困扰了我好多天,不知道哪里错了,增删改都可以就是 public List g

来源:学生作业帮助网 编辑:作业帮 时间:2024/09/30 23:12:02
org.hibernate.hql.ast.QuerySyntaxException:3QException in thread
xSKP+ZX]0R\mlmPчSi؇} -4-eIVO){9/Ĕx^M)!|Q4?,j(㤨R^>q|I&zF IkcH: "j>GBW%}0}ѲMΜUtUx6>qtUcYS|y*f;xk $J!䮤$K*)D GU L4QӐ!" *G$JEOU8pE,B#7Sl7(6ϑ=<\ft{I}Way eYjcQ%hkY}=iSH5= 3ώ137ƪ%mwVjk;MxgM|x{sf琀g_H g(CNk('0]j2&*r3#2Hӳ. N ]W|ztװ[^ eI[1`r5t`}[}Uz3ӹ*}tD=8^ߧ_j 5e

org.hibernate.hql.ast.QuerySyntaxException:3QException in thread "main" org.hibernate.hql.ast.QuerySyntaxException:news is not mapped [from news] 一直是这个错误,困扰了我好多天,不知道哪里错了,增删改都可以就是 public List g
org.hibernate.hql.ast.QuerySyntaxException:3Q
Exception in thread "main" org.hibernate.hql.ast.QuerySyntaxException:news is not mapped [from news] 一直是这个错误,困扰了我好多天,不知道哪里错了,增删改都可以就是 public List getNews(){ return sessionFactory.getCurrentSession().createQuery("from news").list(); } 创建一个查询不行,mapping文件也是自动生成的.

org.hibernate.hql.ast.QuerySyntaxException:3QException in thread "main" org.hibernate.hql.ast.QuerySyntaxException:news is not mapped [from news] 一直是这个错误,困扰了我好多天,不知道哪里错了,增删改都可以就是 public List g
你的数据库表名是不是new啊,因为这new是关键字啊,所以不行啊,你在mapping里这样加 :数据库名.表名,试试.追问:数据库 表名是news mapping是这样的 添加数据,修改,删除都可以 追问:之前用哪个admin为表名也是一样错 回答:怎么你的 实体类 对象跟mapping文件不对应的,hibernate都是对实体对象操作,并不是“from 表名”,你改成这样试试:return sessionFactory.getCurrentSession().createQuery("from New").list();