hibernate配置出错最,怎么办,急救啊…… 是不是必须的 jar包没有引全啊 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 hibernate.cfg.xml这是我的配置文件:<?xml version='1.0' encoding='utf-8'?><!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"><hibernate-configuration><session-factory> <!-- Database connection settings --> <property name="connection.driver_class"> com.mysql.jdbc.Driver </property> <property name="connection.url"> jdbc:mysql://localhost:3306/spring </property> <property name="connection.username">root</property> <property name="connection.password">root</property> <!-- JDBC connection pool (use the built-in) --><!-- <property name="connection.pool_size">1</property> --><!-- SQL dialect --> <property name="dialect"> org.hibernate.dialect.MySQL5Dialect </property> <!--<Enable Hibernate's automatic session context management --> <property name="current_session_context_class">thread</property> <!-- Disable the second-level cache --> <property name="cache.provider_class"> org.hibernate.cache.NoCacheProvider </property> <!-- Echo all executed SQL to stdout --> <property name="show_sql">true</property> <property name="format_sql">true</property> <!-- Drop and re-create the database schema on startup --> <property name="hbm2ddl.auto">update</property> <mapping class="hb.learn.model.User" /></session-factory></hibernate-configuration> 我在java web项目里配置的,只要把javaee 6libraries这里面的包全部删除后,就不会出错了,这是怎么回事尼!? org.hibernate.HibernateException: Unable to get the default Bean Validation factor这个异常需要在hibernate.cfg.xml配置文件中配置:<property name="javax.persistence.validation.mode">none</property> 谢谢楼上的无私奉献,用了这个办法确实可以解决hibernate测试中报此类错误的问题,再次表示感谢! 7楼的方法正确。Spring3+Hibernate3.6+Junit4可以写单元测试。 hibernate 默认会使用bean的校验功能,如果在配置文件中添加<property name="javax.persistence.validation.mode">none</property>这样的配置就是告诉hibernate 我不适用bean校验功能,当然hibernate就不会初始化检验工厂类了,也就不会报错了! 各位大侠今天面试面试官的一个问题 JAVA的应用 大家帮忙看一个spring_security的问题 关于JNA调用C++的问题数据结构。。 hibernate + struts 问题 简单问题,HQL查日期为空的记录 程序员联盟 群号:3546259 欢迎it界从事计算机程序的加盟 session的生命周期问题? java门外汉的几点疑问 请问sqlj是个什么东西? java写入txt不被覆盖? Integer自动拆箱问题
这是我的配置文件:<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"><hibernate-configuration><session-factory> <!-- Database connection settings -->
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="connection.url">
jdbc:mysql://localhost:3306/spring
</property>
<property name="connection.username">root</property>
<property name="connection.password">root</property> <!-- JDBC connection pool (use the built-in) --><!--
<property name="connection.pool_size">1</property>
--><!-- SQL dialect -->
<property name="dialect">
org.hibernate.dialect.MySQL5Dialect
</property> <!--<Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property> <!-- Disable the second-level cache -->
<property name="cache.provider_class">
org.hibernate.cache.NoCacheProvider
</property> <!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<property name="format_sql">true</property> <!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">update</property> <mapping class="hb.learn.model.User" />
</session-factory>
</hibernate-configuration>
这个异常需要在hibernate.cfg.xml配置文件中配置:
<property name="javax.persistence.validation.mode">none</property>
hibernate测试中报此类错误的问题,再次表示感谢!
<property name="javax.persistence.validation.mode">none</property>
这样的配置就是告诉hibernate 我不适用bean校验功能,当然hibernate就不会初始化检验工厂类了,也就不会报错了!