最近刚开始学hibernate,碰到一些问题,将一些错误和解决的方法写写
1.Exception in thread "main" org.hibernate.exception.SQLGrammarException:
<generator class="native"/>改为 <generator class="uuid"/>
2.Exception in thread "main" org.hibernate.InvalidMappingException:
可能是property name和实体类的名字有冲突
3.Duplicate property mapping of Id_Card_No found in········
*.hbm.xml必然有一个属性是重复的写了
4.IllegalArgumentException occurred calling getter of··········
自己碰到这个问题的原因是对多对一映射不了解,其实这个错误地原因是是待写入数据库的值和数据库字段类型不相匹配
5.Exception in thread "main" org.hibernate.MappingException: Unknown entity:
某个类没有映射,或者是映射文件没有加载到hibernate.cfg.xml
6.Unknown column '***' in 'where clause'
我遇到这个问题的原因是在要查询string类型的字段,但是没有在hql语句的查询的值中加入单引号。