Questions tagged [bean-validation]

Bean Validation, previously commonly called just "JSR-303", is an annotation based validation framework for javabean properties and parameters of arbitrary methods. Hibernate Validator is the reference implementation and the most widely used one.

Online resources

1913 questions
0
votes
1 answer

Order of JSR-303 and Validatable validation in play

In a Play (now 2.6) project, both annotation based validation (for example, @Constraints.Required) as well as validation via the Validatable (plus @Validate) are used. This worked fine until now, but as of play 2.6 both are now executed…
Florian Schaetz
  • 10,454
  • 5
  • 32
  • 58
0
votes
1 answer

Spring Boot method validation

Problem I have the following constraints on userUuid and itemUuid: Both strings must not be null. Both strings must be UUIDs (eg. f1aecbba-d454-40fd-83d6-a547ff6ff09e). The composition (userUuid, itemUuid) must be unique. I tried to implement the…
Marian
  • 351
  • 2
  • 12
0
votes
2 answers

How do you run Bean Validation on a method level programmatically?

I am trying to create a validator that is given the following method signature: public void validateAllParameters( final Method method, final Object[] parameterValues) If there is a violation, I would be throwing a…
Archimedes Trajano
  • 35,625
  • 19
  • 175
  • 265
0
votes
1 answer

JSR 303 vs Spring validation

I am new to Spring validation. Recently I have been exploring different approaches of validation utilities available in Spring. I found there are basically two approaches: 1. with JSR-303 and 2. by implementing Validator interface in Spring. What I…
Joy
  • 4,197
  • 14
  • 61
  • 131
0
votes
0 answers

JAX-RS Proxy Client Bean Validation Support (RestEasy)

i googled for hours now but didn't find any solution and maybe the entire features isn't available at all. Setup: we have a few microservices each service have a jax-rs 2.0 api which contains our endpoint and dto definitions the dto's contain…
Jens
  • 1
  • 1
0
votes
2 answers

Bean Validation: Receive EntityNotFoundException though have a constraint to validate entity

Technologies: Spring, Hibernate, JSR-303, JQuery Platform: Windows I am trying to implement @IdMustExist JSR-303 constraint. The purpose of the constraint is to check whether the entered id value exists in associated table. Please see this link for…
Jayaprakash
  • 235
  • 1
  • 7
  • 13
0
votes
1 answer

Validate a json field based on another field dynamically

I started to use validation framework @Valid to validate json request with jax-rs Is it possible to validate a field against another field? So this is how I wanna construct the request body: @JsonProperty private Integer…
Mahyar
  • 1,011
  • 2
  • 17
  • 37
0
votes
1 answer

How to retrieved constraint violation messages if stored in different "ValidationMessages.properties" and which contain in different eclipse plugin

I am using hibernate validation framework in eclipse based (RCP) project. I am having a different kind of plug-in in application like say Plugin A Plugin B Validation Plugin "Plugin A" and "Plugin B" contains POJO classes and annotated with…
Shramik
  • 81
  • 8
0
votes
1 answer

Spring boot jsr 303 entity validation messages not visible from messages.properties

I want to interpolate validation messages based on JSR 303 specification into single file instead of ValidationMessages.properties. Just for simplicity. I have read that it is possible with setting of config class which extends from…
Luke
  • 1,163
  • 2
  • 11
  • 19
0
votes
1 answer

Put field value in validation annotation

public class Person { private String id; @Min(value = 1, message = "Age of person id '${id}' must be greater than 0.") private int age; } Is it possible to make '${id}' take the value of the id field in this class? Thanks.
Anna
  • 839
  • 2
  • 17
  • 33
0
votes
0 answers

disable JSR-303 in Spring MVC

We have a legacy product with simple JSP and Servlet technologies and we got a new requirement to implement a REST API based on existing business logic layer. Therefore we thought of integrating Spring MVC and use the Spring's rest support. After…
keth
  • 793
  • 2
  • 11
  • 36
0
votes
1 answer

@NotNull for Double in XML Validation

I need to validate the structure of an XML in input using JSR-303 annotations. So I want my XML to contain all the required tags, and I accept if the XML tags contain no value at all. So there must be all the tags and they can be empty. The problem…
Alessandro Argentieri
  • 2,901
  • 3
  • 32
  • 62
0
votes
2 answers

Spring Boot Validation : coming as {1} in error message

Trying to archive below things in REST API using spring boot, Entity classes annotated with @Size(min=4,message="Size.foo.name") private String name; errorMessages.properties looks like below, errorMessages.properties Size.foo.name=Name field…
Satscreate
  • 495
  • 12
  • 38
0
votes
0 answers

Issue with Bean validation in the DAO Layer

Im working on a jsf + hibernate project, I have a bean which should be validate by hibernate before saving into database, This Bean has 5 fields which should be all validate by @NotNull. My problem is : I have 2 interfaces : the first one I need to…
majdi
  • 43
  • 1
  • 9
0
votes
2 answers

Hibernate validation: give the ability to user to only enter a digits(number) not instead

I have a jsf form and I have an input which normally accept only number(integer) . I want to custom the error message when the user enter a string or char in this field. I want the validation in the data layer thats mean with hibernate annotation.…
majdi
  • 43
  • 1
  • 9