今天做了一个小练习,是关于Hql查询的, 用到test表
总是报错:org.hibernate.hql.ast.QuerySyntaxException: Test is not mapped.网上搜一下,发现出现org.hibernate.hql.ast.QuerySyntaxException问题的人很多,不过他们主要还是因为hql语句中与数据库映射的类名没有写对,比如String HqlString = "from test ......,这里应将test 写成Test。
但我的hql明明是写成大写的Test了,还是:Test is not mapped。
原来是因为没有在spring文件加入Ks.hbm.xml的路径。加进去就正确了