学习hibernate 所遇到的一些Exception
来源:互联网 发布:中国足球 知乎 编辑:程序博客网 时间:2024/05/16 19:47
异常1:Exception in thread "main" org.hibernate.HibernateException: Unable to get the default Bean Validation factory
javax.persistence.validation.mode默认情况下是auto的,就是说如果不设置的话它是会自动去你的classpath下面找一个bean-validation**包,但是找不到,所以beanvalitionFactory错误。
在hibernate.cfg.xml添加属性:<property name="javax.persistence.validation.mode">none</property>
异常2:若是一直是Caused by: java.sql.BatchUpdateException: Table 'hibernate.teacher' doesn't exist
可以添加一条属性:在hibernate.cfg.xml <property name="hbm2ddl.auto">create</property>
异常3:在hibernate+mysql:Field 'id' doesn't have a default value解决办法
使用注解@GeneratorValue,后台报错Field 'id' doesn't have a default value。
@Id
@GeneratedValue
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
这是因为在数据库建表时,没有把id设置成自增。需要在数据库字段设置中,将id字段设置自动增加。
- 学习hibernate 所遇到的一些Exception
- 学习申报系统所遇到的一些hibernate的问题
- hibernate 所遇到的问题
- Java学习中,所遇到的一些问题及解决方案
- 初次配置Hibernate所遇到的问题
- 本人所遇到的Exception汇集,供大家参考
- 小白学习Hibernate遇到的错误以及解决办法(GenerationTarget encountered exception accepting command : Error executing)
- 建站中所遇到的一些问题[原创]
- 今天所遇到的一些问题
- 学习过程中遇到的Exception
- 总结下关于自己学习IE兼容所遇到的的一些问题
- 学习JAVA一个月来,所遇到的一些问题(不全)
- Cocos2dx:cocos2d-x-3.2版本学习过程中所遇到的一些问题
- Hibernat使用中遇到的org.hibernate.exception.GenericJDBCException异常
- hibernate的一些经常遇到的问题
- 学习中目前所遇到的问题
- 学习Hadoop所遇到的问题集
- Hibernate+中遇到的一些错误
- mysql convert() cast()函数
- WINCE中的bib文件 .
- C语言多文件编译时,编译器不检测其声明的变量类型与定义时的类型是否匹配
- 当内部类定义在局部时
- Objective-C 基本语法(1)
- 学习hibernate 所遇到的一些Exception
- 有向图基本算法 -- 遍历算法
- seo每日学习1
- (短信、彩信、语音)协议
- splunk解析数据动作
- linux 各文件的含义
- Linux 信号
- python __set__ __get__ 等解释
- codec_engine 创建属于自己的例子