validation 1 « JPA « Spring Q&A





1. Spring: Obtaining ResourceBundle based on MessageSource    stackoverflow.com

I'm using hibernate validator framework with Spring. A class implementing the Spring Validator validates objects with Hibernate's ClassValidator. To localize ClassValidator's error messages I need to pass a ResourceBundle into the ...

2. Spring JSR303 validation doesn't work like described in Spring Documentation    stackoverflow.com

I tried implementing validation for my web application like described in section 5.7.4.3 of the Spring 3.0 documentation:

<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
    <property name="webBindingInitializer">
      ...

3. jsr 303 (hibernate validator 4) and spring 2.5.x    stackoverflow.com

How can I configure my Spring 2.5.x application to utilize the JSR 303 validation (hibernate validator 4x) ? I'm using Maven, and update the version of hibernate validator to 4.x, though ...

4. How to reuse fieldlength in form, validation and ddl?    stackoverflow.com

I'm working on an Spring application with lots of input forms. I'd like to reuse the field length in the UI-form, validation and JPA annotations. Is there an elegant way to ...

5. Hibernate Validation and Spring 3.x    stackoverflow.com

I am trying to use validation with Spring 3.x. I have annotated a method field with @Valid, added <mvc:annotation-driven/> to my common.xml, and added Hibernate-Validator.jar in the lib/ dir, but I keep ...

6. Spring MVC 3 Validation - Unable to find a default provider    stackoverflow.com

I get an error when trying to set up Spring MVC validation.

javax.validation.ValidationException: Unable to find a default provider
I read in the documents that the default provider they use is the hibernate-validator. ...

7. Using Hibernate Validator with JPA and Spring    stackoverflow.com

I'm using Hibernate Validator 4.0.2, Spring 3.0 and Hibernate 3.3.2 (which, as I understand it, is pre-JPA2) as a JPA 1 provider. I've found it easy to integrate the Validator into the ...

8. Spring Framework form validation, Hibernate beans and bean populating    stackoverflow.com

How can I make beans that contain Hibernate annonations and at the same time it would contain form validation annonations? And when I catch HTTP request I would like automatically populate ...

9. Spring MVC: Where to place validation and how to validation entity references    stackoverflow.com

Let's say I have the following command bean for creating a user:

public class CreateUserCommand {

   private String userName;
   private String email;

   private Integer occupationId;
  ...





10. JSR-303 dependency injection and Hibernate    stackoverflow.com

Spring 3.0.2, Hibernate 3.5.0, Hibernate-Validator 4.0.2.GA I am trying to inject Spring dependencies into a ConstraintValidator using:

@PersistenceContext
private EntityManager entityManager;
I have configured the application context with:
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/>
Which, according to the Spring documentation, should allow ...

11. Spring 3 MVC validation BindingResult doesn't contain any errors    stackoverflow.com

I'm attempting to get a Spring 3.0.2 WebMVC project running with the new annotated validation support. I have a Hibernate entity annotated like this:

@Entity
@Table(name = "client")
public class Client implements Serializable {
 ...

12. What is the model key for an Errors object in Spring MVC?    stackoverflow.com

In my Spring MVC based web-app, I'm manually creating an Errors/BindingResult object after manually validating one of my domain objects. I can add my domain object into the Model by doing ...

13. bean validation- hibernate error    stackoverflow.com

I am getting following exception when trying to run my command line application:

java.lang.ExceptionInInitializerError
        at org.hibernate.validator.engine.ConfigurationImpl.<clinit>(ConfigurationImpl.java:52)
        at org.hibernate.validator.HibernateValidator.createGenericConfiguration(HibernateValidator.java:43)
 ...

14. How do I retrieve default validation messages from Hibernate Validator?    stackoverflow.com

I'm trying to retrieve a default validation error-message using MessageSource. The code I'm working with uses reflection to retrieve the value of the message parameter. On a constraint that does not ...

15. Unable to locate Spring NamespaceHandler for XML schema namespace [http://jboss.org/xml/ns/javax/validation/configuration]    stackoverflow.com

I am using spring 3, hibernate validator 4. My unit test is running fine. But i am getting this(see below) for my functional test, have i miss out some dependencies? Dependencies i ...

16. javax.validation.ValidationException: Unable to find default provider    stackoverflow.com

I am currently working on Spring MVC web app and trying to hook up validation using the @Valid annotation. When I fire up the application I'm getting the following exception:

javax.validation.ValidationException: Unable ...





17. Spring MVC and JSR-303 hibernate conditional validation    stackoverflow.com

I've a form I want to validate. It contains 2 Address variables. address1 has always to be validated, address2 has to be validated based on some conditions

public class MyForm {
  ...

18. spring3 mvc @Valid annotation cannot be found    stackoverflow.com

I try to use @Valid annotation, but eclipse always gives the "Valid cannot be resolved to a type" error. I m using the spring3 library. I have imported hibernate-validator-4.1.0.Final.jar into my ...

19. How to standardize and organize error messages with Hibernate Validator (running under Spring framework)    stackoverflow.com

I'm learning Hibernate Validator. I see that I can add an error message text to any annotation. But this seems like a bad way to handle error messages. It would be cleaner ...

20. Hibernate Validator, custom ResourceBundleLocator and Spring    stackoverflow.com

I'm trying to override default ResourceBundleLocator in hibernate validation 4.1. So far it works perfectly, but the only examples of its usage include java code to instantiate ValidationFactory. When using a web ...

21. Using a custom ResourceBundle with Hibernate Validator    stackoverflow.com

I'm trying to set up a custom message source for Hibernate Validator 4.1 through Spring 3.0. I've set up the necessary configuration:

<!-- JSR-303 -->
<bean id="validator"
    class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
   ...

22. spring validation with @valid where/how custom error messages    stackoverflow.com

I'm trying to do some spring validation with the error messages in properties files. But the examples I find all seem to have the values hardcoded, or gotten from a properties file ...

23. spring validation: (portlet) issues such as noclassdeffounderror    stackoverflow.com

I'm trying to get spring form validation working. However I'm having some issues. When I deploy my application I get:

Error creating bean wit
h name 'org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#
0': Invocation of init method failed; nested exception is ...

24. Spring validation: can't convert from String to Date    stackoverflow.com

I'm doing some spring form validation, however I'm getting:

Failed to convert property value of type 'java.lang.String' to required type 'ja
va.util.Date' for property 'birthdate'; nested exception is java.lang.Illega
lStateException: Cannot convert value of ...

25. form:errors does not show a list of errors but form:errors path="x" works    stackoverflow.com

I'm trying to show a complete list of my form errors. Now I can do <form:errors path="x"/> a few times, but unless I'm mistaken I should be able to just use <form:errors/>? However ...

26. Order messages so their order isn't random    stackoverflow.com

When I do a <form:errors path="*"/> my errors are always shown in a random order. Now I was wondering how I could display them in a set order. What I mean with random ...

27. spring validation: cleanest way to makeup accompanying labels of the validated input    stackoverflow.com

I'm validating the input field that's bound to path. I'm using hibernate-validator 4 for this. Now I'd like to highlight the age label so it pops out of the page (bold, red ...

28. Weird problem with Spring MVC, Bean Validation using @Valid and Hibernate    stackoverflow.com

I have an application uses bean validation in 50 domain classes. It has worked for months without any problems using @Valid in the Spring MVC controllers. Now all of a sudden, I ...

29. Hibernate validator: how to handle rollover? (28/14/2009 becomes 28/2/2010)    stackoverflow.com

I'm using the hibernate validator to validate my forms. I'm having the "problem" that the 9th of the 14th month becomes the second month in the next year. (just en example of ...

30. error while using @Valid in spring mvc 3.0    stackoverflow.com

here what i do in a model class

private Integer height;

@NotBlank
@Length(min = 2, max = 3)
public Integer getHeight() {
    return height;
}

public void setHeight(Integer height) {
    ...

31. Is it possible for Spring's JSR-303 implementation to validate object fields that are not from form input?    stackoverflow.com

Hibernate's validator is my JSR-303 provider in my Spring MVC application. When I use @Valid, and then use the JSR-303 annotations on the form object fields, it validates just fine. However, ...

32. Hibernate validator: @email accepts ask@stackoverflow as valid?    stackoverflow.com

I'm using the @email annotation to validate an e-mail address. THe issue I'm having is that it's accepting things like ask@stackoverflow as a valid e-mail address. I guess this is because they want ...

33. hibernate unique key validation    stackoverflow.com

i have a field say 'user_name' in table that should be unique. what is the best way for validation using spring - hibernate validation? Thanks in advance. Regards, Nidhin

34. Implementation of LocalValidatorFactoryBean other than hibernate-validator?    stackoverflow.com

Do you know an implementation of springframework's LocalValidatorFactoryBean other than hibernate-validator (fetch too many dependencies) ? We don't want hibernate-validator because it fetches too many dependencies in a very small spring-mvc 3 ...

35. Is there any configuration necessary to use Hibernate Validation custom messages    stackoverflow.com

I'm using the following class to validate my beans with Hibernate Validation. It works great. It's basically the listener found here for JPA 1, converted to use ...

36. javax.validation.ConstraintViolationException: validation failed for classes during update time for groups    stackoverflow.com

I have a Java / Spring MVC 3 application, using Hibernate and a MySQL database. In my controller, I have this source code:

Set<ConstraintViolation<Person>> failures = validator.validate(p);
if (failures.isEmpty()) {
    Project ...

37. How do I dynamically resolve message parameters with Hibernate Validator?    stackoverflow.com

I'm using Hibernate Validator and would like to resolve the category's name in an error message. Consider this simple scenario:

public class Category {
    private String name;
}

public class Product ...

38. Is there a way to use JSR-303 (hibernate) annotations and modify the Message using {0} {1} syntax?    stackoverflow.com

Is there a way to use JSR-303 (hibernate) annotations and modify the Message using {0} {1} syntax? It seem that using a Spring Validator gets you this: String args[] = {"mark", ...

39. Unable to resolve Hibernate Validator messages    stackoverflow.com

For some reason, I'm not able to resolve Hibernate Validator messages. I have the following in my applicationContext.xml:

<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
    <property name="basenames">
       ...

40. The best way to distribute this framework    stackoverflow.com

I just created a framework (it would be more accurate to describe it as an integration), and I'm wondering what would be the best way to distribute it. The project is ...

41. Is there a standard way to enable JSR 303 Bean Validation using annotated method arguments    stackoverflow.com

I've been looking a around for a while now with no luck. I'n not using Spring MVC but still want to use @javax.validation.Valid to enable validation of method arguments. To give ...

42. Spring MVC, Hibernate 3 and @Valid Problem    stackoverflow.com

I have a Spring MVC with JDBC that uses @Valid annotations and it all works very nicely, including the validation. Now I have created a similar webapp that uses Hibernate (instead of ...

43. Is hibernate Validation different that JSR bean Validation    stackoverflow.com

Suppose i use

@NotEmpty
private Name;
Now as it is from org.hibernate.validator.constraint.NotEmpty Now in my controller How can i use annotation that work with hibernate because hibernate jar has no @Valid in their jar file also How ...

44. Spring 3 Validation and internationalization    stackoverflow.com

I use this link to config my project's validation: Spring 3 Validation And I added the following dependency:

     <dependency>
        <groupId>org.hibernate</groupId>
 ...

45. How do I apply AOP advice to a ConstraintValidator in Spring?    stackoverflow.com

I am attempting to write my own Validator (as per the JSR-303 specification) under Spring 3.0.x. I annotated the isValid(Serializable, CosntraintValidatorContext) method with @Transactional, but it seems that transactional advice is not ...

46. How to validate date using Custom date proprty editor in spring MVC    stackoverflow.com

I have made the Date in in my java Class and this is the code i have used in controller

@InitBinder
    public void initBinder(final WebDataBinder binder) {
    ...

47. Bean validation (JSR 303) implementation strategy?    stackoverflow.com

Im currently using JSF 2, POJO business logic classes, Spring 3.x, and JPA 2 for my project. After reading some articles, i am currently very interested in putting ...

48. Spring MVC + Hibernate Validator + Velocity    stackoverflow.com

I can't seem to get basic validation working with Spring MVC. I have the following POJO:

public class Example {

    @NotNull(message="You must enter a value")
    @Size(min=2, max="2", ...

49. Spring 3 MVC JSR-303 validation doesn´t show errors    stackoverflow.com

I have problem using annotated validation in spring 3 mvc. I´m not sure if the problems is in validation or Spring´s capability to bind validation errors to BindingResult object. Here is my ...

50. Spring 3 MVC Validation with Hibernate?? Someone please help me out!    stackoverflow.com

Spring 3 MVC Validation with Hibernate?? Someone please help me out! I just starting you Spring 3 MVC Validation with Hibernate?? I found my coding samples on how to use Spring 3 ...

51. hasError is not working; Spring 3 MVC Validation with Hibernate    stackoverflow.com

hasError is not working; Spring 3 MVC Validation with Hibernate! Maybe I am not doing this right but can someone tell me what my hasErrors() is false. I am puttting errors ...

52. Spring 3 MVC Validation with Hibernate, working but trying to make it better    stackoverflow.com

Spring 3 MVC Validation with Hibernate, working but trying to make it better.. I been workking on this and I got it working with the following code but I would ...

53. Spring 3 MVC Validation with Hibernate, error after hasErrors?    stackoverflow.com

I am just learning Spring3 Validation with Hibernate. I wanted to add Validation so I pyt the @Valid in the function call and add the code into the formbean but ...

54. Spring 3 MVC Validation with Hibernate, error after hasErrors?    stackoverflow.com

I am just learning Spring3 Validation with Hibernate. I have this class but I am setting getting the following error org.hibernate.MappingException: Unknown entity: com.stutteringjohnsmith.model.Friend I am doing the sample from

55. Spring 3 MVC Validation with Hibernate; error: org.hibernate.MappingException: Unknown entity    stackoverflow.com

0 down vote favorite I am just learning Spring3 Validation with Hibernate. I have this class but I am setting getting the following error org.hibernate.MappingException: Unknown entity: com.stutteringjohnsmith.model.Friend I am doing the sample from

56. When i m deploying project on JBoss I m gettting error of hibernate-validator.jar of class not found exception    stackoverflow.com

This error is not appearing when I m manually removing hibernate-validator.jar from JBoss but I don't want to do it everytime and my project is build in maven. ...

57. Hibernate Validation and localized error messages?    stackoverflow.com

hi i am using spring,hibernate and i want to provide localized error messages for hibernate annotations so i created to properties files ValidatorMessages.properties, ValidatorMessages_ar.properties and put them in resources folder, and i am ...

58. Control validation annotations order?    stackoverflow.com

i have a field that have two validation annotations

@NotEmpty
@Length(min=3,max=100)
String firstName;
i am just curious to know how hibernate is specifying the order of which validation annotation to be executed first, and if ...

59. Query inside custom validator    stackoverflow.com

I have written class-level JSR-303 constraint annotation that accepts a method name as a parameter. The method name that you set as parameter should return a boolean value. I have entity Foo ...

60. JSR-303 with Spring and Hibernate mixed error messages    stackoverflow.com

What I would like to do is have a standard error message that uses an annotation to fill in a value on the said error message. The code should help explain. I ...

61. Problems with Hibernate Validator and Spring Webflow    stackoverflow.com

I'm trying to validate a form using Spring WebFlow and Hibernate Validator Annotations, but I'm doing something wrong. If I use the Spring validation way (ValidationContext, MessageContext, validate${state}, etc), all works fine, ...

62. Unit testing JSR-303 validation in Spring    stackoverflow.com

I am trying to add a unit test for an annotated bean in spring using JSR-303 validation. The bean is a simple one like this:

public class Bean {
   @Size(max=XX)  ...

63. Hibernate JSR303 validation and incorrectly generated propertyPath    stackoverflow.com

I'm trying to set up JSR-303 validation of forms using Spring MVC. I had everything configured correctly (or at least I think I do), and validations are working mostly correctly. ...

64. JSR-303 validation with custom message    stackoverflow.com

I'm using Spring 3.0.5-RELEASE, with JSR-303 style validation and Hibernate validator 4.1.0-Final. My model class looks something like this:

public class Model {
    @Max(value=10,message="give a lower value")
   ...

65. Spring javax.validation annotation not caught in BindingResult    stackoverflow.com

I am trying to add validation to my model objects (which double as my form backing beans) using javax.validation annotations. My model looks like this:

public Class TestObject {
    private ...

66. Flex/Spring/Hibernate validation - spring Validator and ExceptionTranslator    stackoverflow.com

I'm beginner in mentioned technologies and forgive me if I ask some dumb questions. I have design problem with validation code in my app. Very often i break the DRY principle. Besides, ...

67. Validation for generated JAXB Classes (JSR 303 / Spring)    stackoverflow.com

I Generated domain objects from schema (request & response) using JAXB (maven-jaxb2-plugin)
I would like add validations (notnull /empty) for couple of attributes. I would like to have custom Bean Validation, the ...

68. Validate object existence before deletion or update in Spring/Hibernate     stackoverflow.com

I'm using Spring/Hibernate combination for my project, with standard CRUD operations. I wonder, is it reasonable to validate object existence before its deletion or update? If it is, where is the most ...

69. error: No validator could be found for type: java.lang.Integer?    stackoverflow.com

I am working on a project with Spring why do I keep getting the following error? javax.validation.UnexpectedTypeException: No validator could be found for type: java.lang.Integer

Code:

package com.s2rsolutions.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Size;

import ...

70. javax.validation.ConstraintViolationException: Bean Validation constraint(s) violated on preUpdate validation    stackoverflow.com

I'm having an annoying error message while trying to insert new element in a many to many relationship using JPA 2.0, SpringMvc 3.0. I have a table with States and another one ...

71. Source of org.hibernate.validator.engine.ConfigurationImpl    stackoverflow.com

OK, I'm trying to get a validator working with a jsp form.. Have just started using maven, so it's all a bit new... what's the best way of locating which repository ...

72. Programmatic Bean Validation (JSR 303) without Annotation    stackoverflow.com

Possible Duplicate:
using Hibernate Validator without calling annotation.
I have this composite constraint annotation (only for illustration):
@Target... @Retention...
@Constraint(validatedBy = {})
@Pattern(regexp = PasswordComplexity.AT_LEAST_TWO_NONE_ALPAH_CHARS)
@Length(min = 6, max = ...

73. Integrate Spring Web Flow 2.2.1 with Hibernate Validator 3.1.0.GA    stackoverflow.com

is there any way to easily integrate Web Flow 2.2.1 with Hibernate Validator 3.1.0.GA? I'm on JBoss 5.1.0 so the version of hibernate-validator bundled, 3.1.0.GA, is pre-jsr 303 Otherwise is there an easy ...

74. Hibernate validator is working on commit time    stackoverflow.com

I would like to use hibernate validator in my project. However when i use @Lenght validator it is validating on commit time. This is my entity

@Entity
@Table(name = "TEST_ENTITY")
public class TestEntity ...

75. How do you order the display of BindingResult errors according to the order of the fields on the page?    stackoverflow.com

I am using the hibernate implementation of jsr303 for server side validation. When Set<ConstraintViolation<?>> is returned I immediately add the errors to a BindingResult for display on the page. ...

76. Can't get Hibernate Validator working with Spring MessageSource    stackoverflow.com

I'm trying to get Hibernate Validator setup to use messages from a Spring MessageSource. I have the following setup in my messages-context.xml:

<bean id="messageSource"
    class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
    <property ...

77. how to return a custom message in jsp using spring 3 mvc and hibernate validator(jsr303)    stackoverflow.com

I have a project using spring 3 mvc and hibernate validator to validate form object. I follow spring's document In my controller, I can get bindingresult, which bindingresult.hasErrors() == true. I ...

78. Spring MVC with Hibernate Validator. How to validate property by group?    stackoverflow.com

There are two problems: 1.Sping/MVC use hibernate validater, Custom validater how to show message? like: Cross field validation with Hibernate Validator (JSR 303)

@FieldMatch.List({
    @FieldMatch(fieldName="password",verifyName="passwordVerify",message="password confirm valid!", groups={Default.class})
})
@ScriptAssert(lang="javascript",script="_this.name.equals(_this.verifyCode)")
public class LoginForm ...

79. @NotBlank doesn't seem to work    stackoverflow.com

1) I am using Spring / Hibernate validator for validation, to check whether a field has only whitespaces or is left balnk i am using @NotBlank (import org.springmodules.validation.bean.conf.loader.annotation.handler.NotBlank;) annotation on "String ...

80. Spring validator: having both annotation and validator implementation    stackoverflow.com

Is it possible to have both a validator for a form and annotation constraints? For example to have in a form object this field:

@NotEmpty
private String date;
but then validate the date's pattern in ...

81. Spring 3 validation (JSR-303) @Min    stackoverflow.com

I am trying to validate an input field that is supposed to contain (if not empty) a natural number (i.e. a positive non-zero integer: 1, 2, 3, ....) I am using the ...

82. problem with validating form in spring under hibernate validator    stackoverflow.com

i have a problem with a simple form in spring that use validating with hibenate validator my form:

 <form:form method="POST" commandName="info">

     username:<form:input path="username"/> <form:errors path="username"></form:errors>
    ...

83. Spring MVC 3 and JSR 303 validation    stackoverflow.com

I have a question about using JSR 303 validation with Spring MVC. I'm trying to use hibernate 3.6.5-Final, Spring MVC 3 and hibernate-validator 4.0.2 GA. Here is an example of validation configuration in ...

84. How to use @Valid with custom validation?    stackoverflow.com

i am using hibernate validation annotation framework to validate my domain classes and validating my domain object with @Valid annotation as follows:

@RequestMapping(method = RequestMethod.POST)
    public String post(@Valid @ModelAttribute("person") Person ...

85. hibernate validator without using autowire    stackoverflow.com

I'am currently working on a Jersey project and decided to use Hibernate validator for the parameter validations. All dependencies injected on the Endpoint classes are properly initialized. However for those dependencies ...

86. In Spring MVC, how to gracefully handle Validate.notNull IllegalArgumentException when a "get by id" finds no item?    stackoverflow.com

I have a Spring MVC web app and use Hibernate for persistence. I have a table of vehicles. Each vehicle has a unique ID. One webpage in my app lists ...

87. How to do the Hibernate validation on the nested list objects?    stackoverflow.com

I need to validate the objects which are stored in the list on my form bean object. Below is my form bean object.

public class Role implements java.io.Serializable {

    // ...

88. showing error generated by validation actionform data separately in struts    stackoverflow.com

i am developing a web application using struts, spring and hibernate. One point to be clear first: the code level is limited to jdk1.4. i want to validate inputs from user (actionForm) ...

89. validation in struts/spring/hibernate under jdk1.4    stackoverflow.com

I am developing a web application using struts2+spring+hibernate, when it comes to validation, i am confused which framework/ methodology to use. Should i use the struts2 validation framework, spring validator or ...

90. JSR-303 inject locale into custom validator    stackoverflow.com

I am using Spring 3 and I have the following configuration in my applicationContext.xml:

  <bean id="validationMessageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"
    p:basename="classpath:messages/validation_messages" p:defaultEncoding="UTF-8" p:cacheSeconds="3" />

  <bean id="globalValidator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
   ...

91. Can I use spring hibernate validator to validate read only data from ibatis?    stackoverflow.com

I'm working with a legacy database that I have no influence over and which is likely to contain poor quality data with many non sensible scenarios. I'd like to validate the ...

92. Merging ConstraintViolation set from validator.validate with ConstraintValidatorContext    stackoverflow.com

Is there some method (other than foreach, but good foreach could be sufficient), to return messages from validator.valid from custom ConstraintValidator ? Simple example (yes, I'm trying to do conditional validation)

98. How to get the interpolated message of ValidationException of Hibernate Validator    stackoverflow.com

Running ex.getMessage() gives me:

    Property 'firstname' threw exception; nested exception is javax.validation.ValidationException:
 Error validating field firstname of class com.inferoquest.entity.Employee:
 [ConstraintViolationImpl{interpolatedMessage='Name cannot be shorter than 2 characters',
 propertyPath=firstname, rootBeanClass=class ...

99. Hibernate Exception: Unable to get the default Bean Validation factory    stackoverflow.com

I'm trying to configure Spring and Hibernate in my project, and I'm having problem at the bean validation. I have this jar in my class path:
hibernate-validator-4.2.0.Final.jar I have some tests to query ...

100. How to validate two or more beans in a Spring Controller method with Hibernate Validator (JSR 303)    stackoverflow.com

I have two classes (Beans)

public class BeanOne {
  @Min(1)
  private Integer idBeanOne;
  @NotBlank
  private String  nameBeanOne;
  @NotNull
  @Min(1)
  private Integer idOther;
  // ...