bean-validation Questions

8

Solved

I want to validate my request body with @Valid annotation, but it's not working in Spring Boot I have a Request class within JAR file which I can't modify with two fields. One field is of type Obj...
Skaggs asked 2/8, 2019 at 11:19

7

Solved

I have a entity called User and I want to validate a mobile number field The mobile number field is not mandatory it can be left blank but it should be a 10 digit number. If the user enters any ...

5

Solved

I have a spring boot project that has a CrudRepository, an Entity and a Controller. I am basically trying to persist an entity based on the data passed to the Controller. To do this, I am using sp...
Goy asked 5/11, 2014 at 18:34

2

Solved

I have following Dto classes structure public class MyDto { @Email private String mail; public String getMail() { return mail; } public void setMail(String mail) { this.mail = mail; } } ...
Lunchroom asked 1/11, 2023 at 16:57

6

I have an "AllowedValuesValidator.java" class: public class AllowedValuesValidator implements ConstraintValidator<AllowedValues, String> { String[] values; String defaultValue; @Overrid...
Shinto asked 27/2, 2015 at 15:27

4

I do validation with JSR-303 in my Spring app, it works as needed. This is an example: @Column(nullable = false, name = "name") @JsonProperty("customer_name") @NotEmpty @Size(min = 3, max = 32...
Rheinland asked 18/1, 2017 at 11:10

8

When the PathVariable 'name' doesn't pass validation a javax.validation.ConstraintViolationException is thrown. Is there a way to retrieve the parameter name in the thrown javax.validation.Constrai...
Lownecked asked 11/4, 2016 at 17:12

2

Bean Validation specification defines: Constraint annotations must define a payload element that specifies the payload with which the constraint declaration is associated. The type of the payloa...
Kent asked 24/11, 2019 at 13:51

3

In a traditional web application it is easy to validate the request body in the controller method, eg. ResponseEntity create(@Valid @ResponseBody Post post) { } If it is a MVC application, we ...

7

Solved

I have a field, say, user_name, that should be unique in a table. What is the best way for validating it using Spring/Hibernate validation?
Timotheus asked 6/1, 2011 at 8:28

2

Solved

The annotated Spring validation on fields of a POJO works when it is created from JSON request body. However, when I create the same object manually (using setters) and want to trigger validation, ...
Expendable asked 24/2, 2015 at 17:51

1

Solved

I'm trying to use a method parameter validation feature supported by Bean Validation 1.1. For instance, the following method triggers the validation of the first parameter, making sure it's valid: ...
Persas asked 11/1, 2023 at 15:29

22

Solved

What configuration is needed to use annotations from javax.validation.constraints like @Size, @NotNull, etc.? Here's my code: import javax.validation.constraints.NotNull; import javax.validation.c...
Koroseal asked 6/1, 2012 at 10:56

2

I'm looking to validate my object properties using customized validators, and i need to inject some beans. So i can't autowire any beans and i get this exception : java.lang.NoSuchMethodException: ...
Goodsized asked 22/11, 2021 at 12:28

3

Solved

I have the following error javax.validation.UnexpectedTypeException: HV000030: No validator could be found for constraint 'javax.validation.constraints.Size' validating type 'java.lang.Integer...
Pacificism asked 3/5, 2018 at 17:26

4

Solved

I have requirement that in common api module(multi module project) I can't use any kind of hibernate's validation annotations, so I did use one from javax.validation which is acceptable. Problem ...

3

Solved

In our project we have Service and DAO layers in separate Maven modules. Service module depends on DAO module and works with it's entities. The problem is that we can't put custom jsr 303 constrain...
Lucier asked 30/7, 2012 at 11:35

3

Solved

so first of all i could not think of a better title for this question so i'm open for changes. I am trying to validate a bean using the bean validation mechanism (JSR-380) with spring boot. So i ...
Ninetta asked 15/9, 2018 at 13:47

4

Solved

I am trying to put validation to a Spring Boot project. So I put @NotNull annotation to Entity fields. In controller I check it like this: @RequestMapping(value="", method = RequestMethod.POST) pu...
Landan asked 6/9, 2016 at 11:43

2

i have a question to Spring boot and the dependency jakarta-validation-api. Actually i have a simple DTO which holds some properties. But this properties are not being validated when I call the RES...
Unwept asked 24/1, 2021 at 9:8

4

Solved

I have created a Spring MVC REST service using Bean Validation 1.2 with the following method: @RequestMapping(value = "/valid") public String validatedMethod(@Valid ValidObject object) { ...
Corwun asked 17/7, 2014 at 19:11

2

Solved

There are two existing variants of this question: Validate only if the field is not Null : A solution to a conditionally handling a String field Hibernate validation - only validate if object is...
Papeterie asked 21/5, 2014 at 22:27

5

Solved

I'm trying to add constraints checking, as described here How to specify the cardinality of a @OneToMany in EclipseLink/JPA
Septilateral asked 25/4, 2010 at 8:52

4

Solved

I am using Hibernate Validation annotations in my JSF managed bean. When I use @NotNull, @NotBlank or @NotEmpty they doesn't seem to be triggered in any way. @NotBlank(message = "{name.required}")...
Dullard asked 25/9, 2011 at 11:34

2

0.4 and hibernate validator 4.1.0.Final, I created a custom validator for validating password and confirmPassword fields, but the validator thrown the following exception: 00:16:11,891 DEBUG [org....
Socle asked 9/11, 2012 at 14:1

© 2022 - 2024 — McMap. All rights reserved.