hibernate 中出现 table is not mapped 问题
作者:admin 日期:2008-10-07
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
评论: 0 | 引用: 0 | 查看次数: 4910
发表评论
你没有权限发表留言!