hibernate4.0.1,出现错误 Error applying BeanValidation relational constraints。
需要在hibernate.cfg.xml中添加
<property name="javax.persistence.validation.mode">none</property>
由于javax.persistence.validation.mode的属性值默认是auto,所以会出错。
在hibernate.cfg.xml里将javax.persistence.validation.mode设置为none即可。
详细错误:
2012-3-3 21:59:25 org.hibernate.validator.util.Version <clinit>
信息: Hibernate Validator bean-validator-3.0-JBoss-4.0.2
Initial SessionFactory creation failed.org.hibernate.HibernateException: Error applying BeanValidation relational constraints
Exception in thread "main" java.lang.ExceptionInInitializerError
at jp.co.ricoh.dao.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:29)
at jp.co.ricoh.dao.util.HibernateUtil.<clinit>(HibernateUtil.java:16)
at jp.co.ricoh.dao.impl.EmployeeDaoImpl.addEmployee(EmployeeDaoImpl.java:13)
at jp.co.ricoh.domain.test.Test.main(Test.java:24)
Caused by: org.hibernate.HibernateException: Error applying BeanValidation relational constraints
at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.applyRelationalConstraints(BeanValidationIntegrator.java:219)
at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.integrate(BeanValidationIntegrator.java:126)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:294)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1775)
at jp.co.ricoh.dao.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:26)
... 3 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.applyRelationalConstraints(BeanValidationIntegrator.java:208)
... 8 more
Caused by: org.hibernate.HibernateException: Unable to build the default ValidatorFactory
at org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory(TypeSafeActivator.java:524)
at org.hibernate.cfg.beanvalidation.TypeSafeActivator.applyDDL(TypeSafeActivator.java:119)
... 13 more
Caused by: javax.validation.ValidationException: Unable to instantiate Configuration.
at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:272)
at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
at org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory(TypeSafeActivator.java:521)
... 14 more
Caused by: java.lang.NullPointerException
at java.util.ResourceBundle.getBundle(Unknown Source)
at org.hibernate.validator.engine.ResourceBundleMessageInterpolator.loadBundle(ResourceBundleMessageInterpolator.java:202)
at org.hibernate.validator.engine.ResourceBundleMessageInterpolator.getFileBasedResourceBundle(ResourceBundleMessageInterpolator.java:182)
at org.hibernate.validator.engine.ResourceBundleMessageInterpolator.<init>(ResourceBundleMessageInterpolator.java:81)
at org.hibernate.validator.engine.ResourceBundleMessageInterpolator.<init>(ResourceBundleMessageInterpolator.java:73)
at org.hibernate.validator.engine.ConfigurationImpl.<init>(ConfigurationImpl.java:57)
at org.hibernate.validator.HibernateValidator.createGenericConfiguration(HibernateValidator.java:43)
at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:269)
... 16 more
参考:http://www.howsky.net/index.php/archives/4630
分享到:
相关推荐
- Bean验证约束(BeanValidation constraints)。 - 附加约束(Additional constraints)。 #### 3. 声明和验证方法约束(Declaring and validating method constraints) 关于方法级的约束,这一部分讲述了: -...
UML和模式应用 Applying UML and Patterns(中文版).pdf
《Applying Design for Six Sigma to Software and Hardware Systems》是一本由Eric Maass和专家共同编写的书籍,旨在向工程师们介绍如何将六西格玛设计(DFSS)应用于软件和硬件系统开发,以提高产品的成功概率。...
Applying UML and Patterns第三版电子书,完整版
《Applying UML and Patterns》是一本专注于面向对象分析与设计(OOA/D)的经典著作,结合统一过程(UP)理论,深入浅出地讲解如何使用统一建模语言(UML)来有效地进行软件开发。面向对象分析与设计是软件工程中的...
《Applying UML and Patterns》是一本经典的软件工程著作,由Craig Larman撰写,它深入浅出地介绍了统一建模语言(Unified Modeling Language,UML)以及如何在实际开发过程中应用设计模式。这本书是IT行业内理解和...
Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and the Unified Process, Second Edition
Applying Uml And Patterns: An Introduction To Object-Oriented Analysis And Design, And The Unified Process.Craig Larman,2001
Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development (3rd Edition) <br>by Craig Larman <br>Publisher: Prentice Hall PTR; 3 edition ...
《Applying UML and Patterns 3rd Edition》是由Craig Larman所著的一本关于面向对象分析与设计以及迭代开发的书籍。这本书是业内公认的经典教材,不仅深入浅出地介绍了面向对象的思维方式,还涵盖了如何在实际工作...
《Applying UML and Patterns》是Craig Larman撰写的一本经典教材,主要涵盖了面向对象分析与设计以及统一建模语言(UML)的应用。在第三个版本中,Larman深入探讨了如何有效地使用UML来支持软件开发过程,特别是在...
《应用领域驱动设计与模式》(Applying Domain-Driven Design and Patterns)是一本针对.NET平台开发人员的专业书籍,作者是Jimmy Nilsson。该书出版于2006年5月8日,由Addison Wesley Professional出版社出版。全书...
《Applying Graph Theory in Ecological Research》这本书由Cambridge University Press出版,作者Mark R. T. Dale是不列颠哥伦比亚大学生态系统科学与管理项目的教授,也是区域项目主任。他研究兴趣广泛,包括植物...
uml和模式应用 applying uml and patterns(中文版).part5
《Applying UML and Patterns》是一本经典的IT书籍,专注于教授如何使用统一建模语言(UML)和设计模式进行面向对象设计。UML是一种图形化的建模工具,用于描述软件系统的行为和结构,而设计模式是软件开发中经过...
全志R16的android4.4.2平台点亮gc2145(evb30) 版本:V1.1 1、配置ov2640在android层配置的分辨率为vga(预览/拍照/录像) 注意:系统自带的快拍APP就在这里查找分辨率参数发送到camera的HAL层。...
一本从概念到实践都能叙述的很清楚的uml教材。学习uml必读。