# Hibernate Validator

**URL:** https://discourse.hibernate.org/c/hibernate-validator/7.md?page=1

[Latest](https://discourse.hibernate.org/latest.md) · [Categories](https://discourse.hibernate.org/categories.md)

**Page:** 2

---

## [Hibernate Validator 7 and Spring MVC 5.3.2 compatible?](https://discourse.hibernate.org/t/hibernate-validator-7-and-spring-mvc-5-3-2-compatible/4927)

<div class="topic-metadata">

**Author:** [@karthikbargat](https://discourse.hibernate.org/u/karthikbargat)\
**Replies:** 2\
**Last updated:** [January 14, 2021, 5:03pm UTC](https://discourse.hibernate.org/t/hibernate-validator-7-and-spring-mvc-5-3-2-compatible/4927 "2021-01-14T17:03:24Z")

</div>

Is Hibernate Validator 7 compatible with Spring MVC 5.3.2? The reason I am asking because I have a project where I need to perform Spring MVC Validation using Hibernate Validator.

---

## [Memory Consumption (5.2.x)](https://discourse.hibernate.org/t/memory-consumption-5-2-x/4841)

<div class="topic-metadata">

**Author:** [@jamesd](https://discourse.hibernate.org/u/jamesd)\
**Replies:** 1\
**Last updated:** [December 21, 2020, 10:19pm UTC](https://discourse.hibernate.org/t/memory-consumption-5-2-x/4841 "2020-12-21T22:19:44Z")

</div>

Hello! First, I know that Hibernate Validator 6.0 is supposed to have improvements with memory usage, but we are currently on Hibernate 5.2. Is that compatible with Validator 6.0? How would I go about seeing what version…

---

## [Hibernate-Validator 6.1.5.Final compatible hibernate version](https://discourse.hibernate.org/t/hibernate-validator-6-1-5-final-compatible-hibernate-version/4487)

<div class="topic-metadata">

**Author:** [@Subbareddy\_Mettupali](https://discourse.hibernate.org/u/Subbareddy_Mettupali)\
**Replies:** 2\
**Last updated:** [August 11, 2020, 3:25pm UTC](https://discourse.hibernate.org/t/hibernate-validator-6-1-5-final-compatible-hibernate-version/4487 "2020-08-11T15:25:11Z")

</div>

I am planning to upgrade hibernate-validator5.2.5 to latest version 6.1.5. What is the compatible hibernate version?

---

## [Does Hibernate Validator support Android?](https://discourse.hibernate.org/t/does-hibernate-validator-support-android/4416)

<div class="topic-metadata">

**Author:** [@Ali\_RS](https://discourse.hibernate.org/u/Ali_RS)\
**Replies:** 0\
**Last updated:** [July 22, 2020, 2:22pm UTC](https://discourse.hibernate.org/t/does-hibernate-validator-support-android/4416 "2020-07-22T14:22:10Z")

</div>

Hi Does Hibernate Validator work on Android? Regards

---

## [Github simple example of hibernate-validator and hibernate?](https://discourse.hibernate.org/t/github-simple-example-of-hibernate-validator-and-hibernate/4411)

<div class="topic-metadata">

**Author:** [@Dean\_Hiller](https://discourse.hibernate.org/u/Dean_Hiller)\
**Replies:** 0\
**Last updated:** [July 21, 2020, 2:10pm UTC](https://discourse.hibernate.org/t/github-simple-example-of-hibernate-validator-and-hibernate/4411 "2020-07-21T14:10:52Z")

</div>

On the web is TONS of examples of hibernate-validator by itself or spring + hibernate-validator + hibernate. I need just a hibernate+hibernate-validator example out there where entityManager.flush fails because of valid…

---

## [When using a @GroupSequenceProvider, how do you get all ConstraintViolations reported at once?](https://discourse.hibernate.org/t/when-using-a-groupsequenceprovider-how-do-you-get-all-constraintviolations-reported-at-once/875)

<div class="topic-metadata">

**Author:** [@pluttrell](https://discourse.hibernate.org/u/pluttrell)\
**Replies:** 4\
**Last updated:** [July 7, 2020, 10:55am UTC](https://discourse.hibernate.org/t/when-using-a-groupsequenceprovider-how-do-you-get-all-constraintviolations-reported-at-once/875 "2020-07-07T10:55:04Z")

</div>

When using a @GroupSequenceProvider, how do you get all ConstraintViolations reported at once? Consider this class: @Data @AllArgsConstructor @GroupSequenceProvider(CarGroupSequenceProvider.class) public class Car { …

---

## [Build a new validator every time a DTO is constructed - is this performant?](https://discourse.hibernate.org/t/build-a-new-validator-every-time-a-dto-is-constructed-is-this-performant/4274)

<div class="topic-metadata">

**Author:** [@Anthony\_Leonard](https://discourse.hibernate.org/u/Anthony_Leonard)\
**Replies:** 3\
**Last updated:** [June 12, 2020, 10:14pm UTC](https://discourse.hibernate.org/t/build-a-new-validator-every-time-a-dto-is-constructed-is-this-performant/4274 "2020-06-12T22:14:40Z")

</div>

A nice approach for validation I’ve seen recently is to make DTOs validate themselves inside their constructors so it is impossible to construct an invalid DTO. See example below. To do the above requires every instan…

---

## [@JsonUnwrapped with hibernate validator](https://discourse.hibernate.org/t/jsonunwrapped-with-hibernate-validator/4270)

<div class="topic-metadata">

**Author:** [@plum117](https://discourse.hibernate.org/u/plum117)\
**Replies:** 0\
**Last updated:** [June 11, 2020, 4:24pm UTC](https://discourse.hibernate.org/t/jsonunwrapped-with-hibernate-validator/4270 "2020-06-11T16:24:44Z")

</div>

Hi, First, sorry I know that @JsonUnwrapped is not owned by, hibernate, but I’m trying to make @JsonUnwrapped works seamlessly with hibernate validator. Example: I have this: public class Request { @JsonUnwrapped …

---

## [Unable to get work constraintDefinition](https://discourse.hibernate.org/t/unable-to-get-work-constraintdefinition/4161)

<div class="topic-metadata">

**Author:** [@dontturnaway](https://discourse.hibernate.org/u/dontturnaway)\
**Replies:** 0\
**Last updated:** [May 13, 2020, 6:33pm UTC](https://discourse.hibernate.org/t/unable-to-get-work-constraintdefinition/4161 "2020-05-13T18:33:26Z")

</div>

I have a custom validator, which validates string for regex pattern (later I’ll make it more complicated). I want to use it for inline validating lot of local String variables in my project, without adding it to the dom…

---

## [Find entities used by all validators on single class before validation process starts, so these entities can be reused and not pulled from the database again and again](https://discourse.hibernate.org/t/find-entities-used-by-all-validators-on-single-class-before-validation-process-starts-so-these-entities-can-be-reused-and-not-pulled-from-the-database-again-and-again/3989)

<div class="topic-metadata">

**Author:** [@Milan\_Batica](https://discourse.hibernate.org/u/Milan_Batica)\
**Replies:** 0\
**Last updated:** [April 8, 2020, 6:59am UTC](https://discourse.hibernate.org/t/find-entities-used-by-all-validators-on-single-class-before-validation-process-starts-so-these-entities-can-be-reused-and-not-pulled-from-the-database-again-and-again/3989 "2020-04-08T06:59:32Z")

</div>

In project i’m currently working on, we use a lot of java bean validations. In many of these validations we need to retrieve entities from data layer so they can be used during validation process. Let’s say for example …

---

## [Force default validation even without annotation](https://discourse.hibernate.org/t/force-default-validation-even-without-annotation/3931)

<div class="topic-metadata">

**Author:** [@WilburLarch](https://discourse.hibernate.org/u/WilburLarch)\
**Replies:** 2\
**Last updated:** [March 24, 2020, 12:09pm UTC](https://discourse.hibernate.org/t/force-default-validation-even-without-annotation/3931 "2020-03-24T12:09:25Z")

</div>

I’m on validation of JSON-input for my RestControllers. Validation is currently done by reflection - any field is detected and a global rule is validated (max string length, no special chars, etc). This can be superseded…

---

## [Hibernate validates wrong schema](https://discourse.hibernate.org/t/hibernate-validates-wrong-schema/3792)

<div class="topic-metadata">

**Author:** [@sainath](https://discourse.hibernate.org/u/sainath)\
**Replies:** 0\
**Last updated:** [February 25, 2020, 10:43am UTC](https://discourse.hibernate.org/t/hibernate-validates-wrong-schema/3792 "2020-02-25T10:43:51Z")

</div>

The actual schema connected and used for validation is “sbusdemo” but it checks other available schemas for validation, displaying “missing column…” error message in console. This happend only in few PCs’. Versions u…

---

## [Hibernate-validator and GraalVM](https://discourse.hibernate.org/t/hibernate-validator-and-graalvm/3547)

<div class="topic-metadata">

**Author:** [@Guillaume\_Albini](https://discourse.hibernate.org/u/Guillaume_Albini)\
**Replies:** 1\
**Last updated:** [December 16, 2019, 9:18am UTC](https://discourse.hibernate.org/t/hibernate-validator-and-graalvm/3547 "2019-12-16T09:18:06Z")

</div>

Hello, I try to used a graalvm native-image to run my application but i have an exception on hibernate-validator. (see below) Caused by: java.lang.IllegalArgumentException: Invalid logger interface org.hibernate.valida…

---

## [Web service request validation, region dependent](https://discourse.hibernate.org/t/web-service-request-validation-region-dependent/3540)

<div class="topic-metadata">

**Author:** [@Dave](https://discourse.hibernate.org/u/Dave)\
**Replies:** 0\
**Last updated:** [December 12, 2019, 11:43pm UTC](https://discourse.hibernate.org/t/web-service-request-validation-region-dependent/3540 "2019-12-12T23:43:18Z")

</div>

I have a web service that is deployed out in multiple regions and requires different validation logic on the request object depending on the region. Things like street addresses and postal codes, phone numbers, emails, …

---

## [Constraint validators instantiated by custom ConstraintValidatorFactory are not bound to ValidatorContext](https://discourse.hibernate.org/t/constraint-validators-instantiated-by-custom-constraintvalidatorfactory-are-not-bound-to-validatorcontext/3346)

<div class="topic-metadata">

**Author:** [@tamm0r](https://discourse.hibernate.org/u/tamm0r)\
**Replies:** 0\
**Last updated:** [October 14, 2019, 5:26pm UTC](https://discourse.hibernate.org/t/constraint-validators-instantiated-by-custom-constraintvalidatorfactory-are-not-bound-to-validatorcontext/3346 "2019-10-14T17:26:50Z")

</div>

I’m working on JUnit tests for constraint validators with dependencies. I created a custom ConstraintValidatorFactory that has access to Mockito mocks and basically everything is working. To reduce the initialization ov…

---

## [Some conflicts between validator and annotation processor](https://discourse.hibernate.org/t/some-conflicts-between-validator-and-annotation-processor/3035)

<div class="topic-metadata">

**Author:** [@Frodez](https://discourse.hibernate.org/u/Frodez)\
**Replies:** 0\
**Last updated:** [July 30, 2019, 11:59am UTC](https://discourse.hibernate.org/t/some-conflicts-between-validator-and-annotation-processor/3035 "2019-07-30T11:59:56Z")

</div>

I have been struggling in a problem that when i have tried to use the Hibernate Validator Annotation Processor to enhance my project’s type safety, i’ve received the message that any constrains on the parameters of overr…

---

## [Hello everybody I am a new member](https://discourse.hibernate.org/t/hello-everybody-i-am-a-new-member/3024)

<div class="topic-metadata">

**Author:** [@dangquan09](https://discourse.hibernate.org/u/dangquan09)\
**Replies:** 0\
**Last updated:** [July 29, 2019, 8:35am UTC](https://discourse.hibernate.org/t/hello-everybody-i-am-a-new-member/3024 "2019-07-29T08:35:32Z")

</div>

Hello everyone I am a new member I am really happy to meet you all

---

## [Custom validator causes StackOverflowException](https://discourse.hibernate.org/t/custom-validator-causes-stackoverflowexception/2914)

<div class="topic-metadata">

**Author:** [@Sidi\_Mohamed\_MOULEY](https://discourse.hibernate.org/u/Sidi_Mohamed_MOULEY)\
**Replies:** 0\
**Last updated:** [June 29, 2019, 2:06pm UTC](https://discourse.hibernate.org/t/custom-validator-causes-stackoverflowexception/2914 "2019-06-29T14:06:45Z")

</div>

Hi, i want to implement ConstraintsValidator which verifies whether an email is available before registering a new user, using spring’s depandency injection “@Autowired” to inject JPA Repository in the validator to make…

---

## [javax.validation.ConstraintDeclarationException: HV000131. Cascaded validation in hierarchy objects](https://discourse.hibernate.org/t/javax-validation-constraintdeclarationexception-hv000131-cascaded-validation-in-hierarchy-objects/2875)

<div class="topic-metadata">

**Author:** [@Manuel\_Jesus\_Gonzale](https://discourse.hibernate.org/u/Manuel_Jesus_Gonzale)\
**Replies:** 0\
**Last updated:** [June 21, 2019, 11:05am UTC](https://discourse.hibernate.org/t/javax-validation-constraintdeclarationexception-hv000131-cascaded-validation-in-hierarchy-objects/2875 "2019-06-21T11:05:30Z")

</div>

I have the next hierarchy: public class A extends B { @Valid public A(String languageCode, C token) { super(languageCode, token); } } The B class has a property call language code that should be valid…

---

## [Bypass getter validation for seemingly getters](https://discourse.hibernate.org/t/bypass-getter-validation-for-seemingly-getters/2816)

<div class="topic-metadata">

**Author:** [@UKreher](https://discourse.hibernate.org/u/UKreher)\
**Replies:** 0\
**Last updated:** [June 6, 2019, 11:47am UTC](https://discourse.hibernate.org/t/bypass-getter-validation-for-seemingly-getters/2816 "2019-06-06T11:47:00Z")

</div>

Hi all, we are using Jersey 2.28 with Hibernate Validator 6.0.15. We have classes (REST resources) providing data via methods called “get\*”. Some of these methods do not have any explicit parameters but retrieve them in…

---

## [I can't integrate hibernate validation into the web using the spring framework.](https://discourse.hibernate.org/t/i-cant-integrate-hibernate-validation-into-the-web-using-the-spring-framework/2807)

<div class="topic-metadata">

**Author:** [@Luxun](https://discourse.hibernate.org/u/Luxun)\
**Replies:** 1\
**Last updated:** [June 5, 2019, 1:45pm UTC](https://discourse.hibernate.org/t/i-cant-integrate-hibernate-validation-into-the-web-using-the-spring-framework/2807 "2019-06-05T13:45:57Z")

</div>

I will try to hibernate validation to join my web project, but if there is a spring in project - the context - the indexer - 5.0.6. RELEASE. This jar jar package, will lead to use at run time to check thrown Java. The la…

---

## [Interface validation is ran twice (Kotlin)](https://discourse.hibernate.org/t/interface-validation-is-ran-twice-kotlin/2584)

<div class="topic-metadata">

**Author:** [@Jukka\_Siivonen](https://discourse.hibernate.org/u/Jukka_Siivonen)\
**Replies:** 0\
**Last updated:** [April 9, 2019, 6:03pm UTC](https://discourse.hibernate.org/t/interface-validation-is-ran-twice-kotlin/2584 "2019-04-09T18:03:38Z")

</div>

Hello, I am not sure if this is a Kotlin issue, but my problem can be reproduced by a simple test interface Foo { @AssertTrue fun isValid() = false } class FooBean : Foo class FooTest { @Test fun tes…

---

## [Using Hibernate Validator in Karaf](https://discourse.hibernate.org/t/using-hibernate-validator-in-karaf/376)

<div class="topic-metadata">

**Author:** [@sim085](https://discourse.hibernate.org/u/sim085)\
**Replies:** 8\
**Last updated:** [March 19, 2019, 7:36am UTC](https://discourse.hibernate.org/t/using-hibernate-validator-in-karaf/376 "2019-03-19T07:36:31Z")

</div>

Hello I am trying to write an example using Hibernate Validation in Karaf but I am having trouble with some dependency errors. What I did so far is download a fresh version of Karaf (version 4.1.4). Start this and ente…

---

## [Stop validation after the first validation error was found](https://discourse.hibernate.org/t/stop-validation-after-the-first-validation-error-was-found/2030)

<div class="topic-metadata">

**Author:** [@elenat](https://discourse.hibernate.org/u/elenat)\
**Replies:** 1\
**Last updated:** [January 14, 2019, 10:23am UTC](https://discourse.hibernate.org/t/stop-validation-after-the-first-validation-error-was-found/2030 "2019-01-14T10:23:44Z")

</div>

Hi , Would it be possible to stop further validations when the first error was found? Regards, Elena

---

## [Don't validate if field if null](https://discourse.hibernate.org/t/dont-validate-if-field-if-null/2192)

<div class="topic-metadata">

**Author:** [@kbax1982](https://discourse.hibernate.org/u/kbax1982)\
**Replies:** 2\
**Last updated:** [February 4, 2019, 12:58pm UTC](https://discourse.hibernate.org/t/dont-validate-if-field-if-null/2192 "2019-02-04T12:58:12Z")

</div>

Hi I am using hibernate validation to validate a brazillian number for companies, called CNPJ @CNPJ @Column(nullable = true, length = 18, unique = true) private String cnpj; But in my form this field is not require…

---

## [Generic field validation](https://discourse.hibernate.org/t/generic-field-validation/2082)

<div class="topic-metadata">

**Author:** [@thomas\_rollinger](https://discourse.hibernate.org/u/thomas_rollinger)\
**Replies:** 1\
**Last updated:** [January 18, 2019, 2:14pm UTC](https://discourse.hibernate.org/t/generic-field-validation/2082 "2019-01-18T14:14:13Z")

</div>

I want to apply a constraint on all string property of an object, but with the programmatic api as I don’t want to annotate all property. class Foo { String value1; Integer value2; @Valid Bar value3; } cl…

---

## [Retrieve current validation context during a test](https://discourse.hibernate.org/t/retrieve-current-validation-context-during-a-test/2068)

<div class="topic-metadata">

**Author:** [@Sergio\_Perez](https://discourse.hibernate.org/u/Sergio_Perez)\
**Replies:** 0\
**Last updated:** [January 16, 2019, 4:49pm UTC](https://discourse.hibernate.org/t/retrieve-current-validation-context-during-a-test/2068 "2019-01-16T16:49:25Z")

</div>

I have this validation: public void initialize(Telephone constraintAnnotation) { setTelephoneCountryCodeField(constraintAnnotation.telephoneCountryCodeField()); setTelephoneField(constraintAnnota…

---

## [Upgrade  to Spring 4.3.15, seeing internal.xml.ValidationXmlParser - No META-INF/validation.xml](https://discourse.hibernate.org/t/upgrade-to-spring-4-3-15-seeing-internal-xml-validationxmlparser-no-meta-inf-validation-xml/2005)

<div class="topic-metadata">

**Author:** [@nik28](https://discourse.hibernate.org/u/nik28)\
**Replies:** 1\
**Last updated:** [January 9, 2019, 9:03pm UTC](https://discourse.hibernate.org/t/upgrade-to-spring-4-3-15-seeing-internal-xml-validationxmlparser-no-meta-inf-validation-xml/2005 "2019-01-09T21:03:55Z")

</div>

i recently upgrade spring from 3.2 to 4.3.15 Release. After that seeing below issue: 2019-01-09 06:42:02,321 \[WebContainer : 21\] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Log4jLoggerProvider 2019-01…

---

## [Using the Built-In Constraints to Make a New Constraint](https://discourse.hibernate.org/t/using-the-built-in-constraints-to-make-a-new-constraint/1969)

<div class="topic-metadata">

**Author:** [@DougBaughman](https://discourse.hibernate.org/u/DougBaughman)\
**Replies:** 2\
**Last updated:** [January 4, 2019, 9:59pm UTC](https://discourse.hibernate.org/t/using-the-built-in-constraints-to-make-a-new-constraint/1969 "2019-01-04T21:59:02Z")

</div>

I’ve followed the example for Using the Built-In Constraints to Make a New Constraint in the Java EE Tutorial. Since Email is a built-in, I switched it to USPhoneNumber, but very similar to the example annotating the US…

---

## [@Valid annotation](https://discourse.hibernate.org/t/valid-annotation/1757)

<div class="topic-metadata">

**Author:** [@ihanna](https://discourse.hibernate.org/u/ihanna)\
**Replies:** 2\
**Last updated:** [November 28, 2018, 11:53pm UTC](https://discourse.hibernate.org/t/valid-annotation/1757 "2018-11-28T23:53:45Z")

</div>

Hello Hibernate Community, I just ask why @Valid annotation doesn’t has message attribute @Valid(message=“Error in number you enter”) as a general validator, also we can config it in properties file like: class Employe…

[Previous page](https://discourse.hibernate.org/c/hibernate-validator/7.md)

[Next page](https://discourse.hibernate.org/c/hibernate-validator/7.md?page=2)
