本文是两年前写的,由于原来的博客放弃了,所以把它转写到这里了(很多文章都是从老的网易博客转来的,:),是本人2年前写的文章)。
在用Hibernate时出现以下问题:
Caused by: java.sql.BatchUpdateException: Table ' testdb.testdb__testtable' doesn't exist
org.hibernate.MappingException: Unknown entity
找到问题所在,由于是使用MyEclipse自动生成的映射文件 test.hbm.xml , 查看配置文件发现
<class name="test.model.TestTable" table="testtable" catalog="testdb">
多了一个catalog属性,将其去掉就好了!: )
补充:
然后再看看自动生成的类文件里面有没有,hashCode()和equals()两个方法,如果没有的话需要自己重写这两个方法.一般就可以解决问题.