继续Java,整合Spring Hiberate
2014-08-28 03:33
239 查看
我直接把配置文件copy过来的,遇到了2个问题,
1,打开Hibernate.cfg.xml 时,弹出窗口:"this project is not a myeclipse hibernate project . assuming hibernate 3 ...",百度后得到更正的方法:
使用版本控制的时候,工程根目录下的: .project 和 .myhibernatedata 文件不在版本控制范围内,因此组内成员更新source后,缺少.project 内的ature>com.genuitec.eclipse.hibernate.hibernatenature</nature> 和.myhibernatedata 文件。
解决:项目名上右键--〉myeclipse-->add hibernate capabilites -->next-->hibernate config file --> existing -->选择现有工程存在的hibernate配置文件--> next --> 不生成factory class --> end
摘自:/article/1794697.html
2. 测试spring和Hibernate的整合,报错:
“Unable to get the default Bean Validation”
javax.persistence.validation.mode默认情况下是auto的,就是说如果不设置的话它是会自动去你的classpath下面找一个bean-validation**包,但是找不到,所以beanvalitionFactory错误。 由于javax.persistence.validation.mode的属性值默认是auto,所以会出错。 在hibernate.cfg.xml里将javax.persistence.validation.mode设置为none,就可以避免出错了。 <!-- Disable the BeanValidation --> <property name="javax.persistence.validation.mode">none</property>
------------------------------------------------------------------------------------------------------------------------------------------
所以,Hibernate 3.6以上版本在用junit测试时会提示错误:
Unable to get the default Bean Validation factory
在hibernate.cfg.xml里增加一属性解决:
<property name="javax.persistence.validation.mode">none</property>
第二个错几乎用了2个小时。哎,不熟悉呀。不过还是解决了。
1,打开Hibernate.cfg.xml 时,弹出窗口:"this project is not a myeclipse hibernate project . assuming hibernate 3 ...",百度后得到更正的方法:
使用版本控制的时候,工程根目录下的: .project 和 .myhibernatedata 文件不在版本控制范围内,因此组内成员更新source后,缺少.project 内的ature>com.genuitec.eclipse.hibernate.hibernatenature</nature> 和.myhibernatedata 文件。
解决:项目名上右键--〉myeclipse-->add hibernate capabilites -->next-->hibernate config file --> existing -->选择现有工程存在的hibernate配置文件--> next --> 不生成factory class --> end
摘自:/article/1794697.html
2. 测试spring和Hibernate的整合,报错:
“Unable to get the default Bean Validation”
javax.persistence.validation.mode默认情况下是auto的,就是说如果不设置的话它是会自动去你的classpath下面找一个bean-validation**包,但是找不到,所以beanvalitionFactory错误。 由于javax.persistence.validation.mode的属性值默认是auto,所以会出错。 在hibernate.cfg.xml里将javax.persistence.validation.mode设置为none,就可以避免出错了。 <!-- Disable the BeanValidation --> <property name="javax.persistence.validation.mode">none</property>
------------------------------------------------------------------------------------------------------------------------------------------
所以,Hibernate 3.6以上版本在用junit测试时会提示错误:
Unable to get the default Bean Validation factory
在hibernate.cfg.xml里增加一属性解决:
<property name="javax.persistence.validation.mode">none</property>
第二个错几乎用了2个小时。哎,不熟悉呀。不过还是解决了。
相关文章推荐
- hiberate4整合Spring3.1时出现 java.lang.NoClassDefFoundError: Lorg/hibernate/cache/CacheProvider
- MyEclipse 6.0 发布- 整合 Spring/JPA Integration, Java 6
- Java : Hibernate3.2 与 Spring2.5整合
- Java与Flex学习笔记(7)----将Spring与Flex整合(基于嵌入式tomcat)(2012-07-24 更新)
- Java程序员从笨鸟到菜鸟之(八十二)细谈Spring(十一)深入理解spring+struts2整合(附源码)
- Java程序员从笨鸟到菜鸟之(八十二)细谈Spring(十一)深入理解spring+struts2整合(附源码)
- MyEclipse 6.0 发布- 整合 Spring/JPA Integration, Java 6
- WebService介绍(WebService基础知识、XFire、CXF(基于XFire和Celtix项目整合而来,与Spring融合好)、AXIS1、AXIS2(有AXIS1转换而来,有Java)
- [原]Java web学习系列之 Java web开发中的SSH整合(Struts、Spring、Hibernate)(下)
- [原]Java web学习系列之 Java web开发中的SSH整合(Struts、Spring、Hibernate)(上)
- memcached之java客户端:spymemcached与spring整合
- java 日记 2008/10/20(spring,struts 整合)
- SoybeanMilk Java MVC框架与Spring整合
- MyEclipse 整合 Spring 和 Hibernate时,报 java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit
- java project整合spring和hibernate
- Java开发,重在整合-----Struts 2整合Spring(15)
- Spring整合Hibernate时出现如下错误Caused by: java.lang.NoClassDefFoundError: javax/persistence/Entity
- spring3.0.5 和hibernate3.6整合问题之java.lang.ClassNotFoundException: org.objectweb.asm.Type
- Java程序员从笨鸟到菜鸟之(七十九)细谈Spring(八)spring+hibernate整合基本详解
- WebService介绍(WebService基础知识、XFire、CXF(基于XFire和Celtix项目整合而来,与Spring融合好)、AXIS1、AXIS2(有AXIS1转换而来,有Java)