【转】hibernate 中出现 table is not mapped 问题 hibernate 中出现 table is not mapped 问题
HQL语句原来是这样写的:
String hql="from person as p where p.id=? and p.password=?";
后来上网查找原因,发现原来person第一个字母应大字,也就是说表名应该是ORM映射的类名。
改成这样就可以了:
String hql="from Person as p where p.id=? and p.password=?";
一般与类名一致
原来的是这样写的:
"delete from table where username = :user"
后来发现原因在于要写成这样:
"delete from User where username = :name"
只要将表明换成ORM映射的类名就可以了
' 引用自http://blog.5ego.net/article.asp?id=35
String hql="from person as p where p.id=? and p.password=?";
后来上网查找原因,发现原来person第一个字母应大字,也就是说表名应该是ORM映射的类名。
改成这样就可以了:
String hql="from Person as p where p.id=? and p.password=?";
一般与类名一致
原来的是这样写的:
"delete from table where username = :user"
后来发现原因在于要写成这样:
"delete from User where username = :name"
只要将表明换成ORM映射的类名就可以了
' 引用自http://blog.5ego.net/article.asp?id=35

文章来自:
Tags:
浙公网安备 33010602011771号