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.
Questions tagged [bean-validation]
1913 questions
0
votes
1 answer
Remote EJB Null value Constraint
I have a weird problem with remote EJB. Here is an entity:
@Entity
@Table(name="cd")
@AttributeOverrides({
@AttributeOverride(name = "id", column = @Column(name = "cd_id")),
@AttributeOverride(name = "title", column = @Column(name =…

Alex Bondar
- 1,167
- 4
- 18
- 35
0
votes
0 answers
Java 8 DateTime API LocalDateTime
I have a DTO class that has a LocalDateTime field in it like the following:
public class MyModel {
@NotNull(message="This field cannot be null")
@DateTimeFormat(iso = ISO.DATE_TIME)
private LocalDateTime startDate;
...
}
And I have…

Furkan
- 683
- 2
- 10
- 26
0
votes
1 answer
Error in Post method spring mvc
I need to capture validation errors for send to View.
I followed several tutorials that way:
My Method with Bean validation:
@RequestMapping(value = "/novo", method = RequestMethod.POST)
public ModelAndView salvar(@Valid Cliente cliente,…

joeyanthon
- 208
- 1
- 2
- 13
0
votes
0 answers
Bean Validations not using proper basename to find resource bundles despite custom messageSource bean
I added a bean (which is being instantiated and which is used when I @Autowire it into my classes. But it's not used by bean validation to get the proper messages.
The bean:
@Bean
public MessageSource messageSource()
{
//Create our message…

Don Rhummy
- 24,730
- 42
- 175
- 330
0
votes
1 answer
How to get the message written in the message attribute of JSR 303 validation using annotation
My scenario is :
I have a pojo class with JSR 303 validations as follows :
public class Customer{
String customerId;
String name;
BigDecimal salary;
@NotNull(message = "CustomerId is mandatory")
@Size(max…

Rabin Pantha
- 941
- 9
- 19
0
votes
1 answer
Cannot delete an entity using morphia (mongodb)
I keep getting the same error whenever I try to delete an entity using Morphia:
org.mongodb.morphia.query.ValidationException: The field '_id' could not be found in ...
while validating - _id; if you wish to continue please disable validation.
I…

Rico Kahler
- 17,616
- 11
- 59
- 85
0
votes
1 answer
Drools bean validation using constraints from data base
I have a requirement to write the drools program to validate a bean properties based on the constraints stored in data base. For example:
class Product {
private String description;
private String partNumber;
private int price;
…

Ramesha.C
- 69
- 1
- 7
0
votes
1 answer
Bean Validation XML entire bean
I am required to use bean validation using XML.
We can validate the whole class by putting annotations just before the class declaration.
@AtLeastOneNotNull
public class SampleBean {
// ...
}
And then use reflection to loop over the…

Charles Follet
- 827
- 1
- 10
- 28
0
votes
2 answers
NullValueInNestedPathException for Bean[] class binding
Hello I'd like to ask if you can assign arrays of beans as a form
for example i have a form:
PageForm{
Group[] groupArray;
Group[] getGroupArray(){
return groupArray;
}
void setGroupArray( Group[] groupArray ){
…

ian
- 51
- 2
- 4
0
votes
0 answers
Input validation with JSR-303 & Spring Boot (Rest Controller): HTML response instead of JSON
I followed these two links/tutorials:
a) Spring MVC: How to perform validation?
b) https://g00glen00b.be/validating-the-input-of-your-rest-api-with-spring/
It works fine except for one thing. Eventhough my controller is annotated with…

Pawel Os.
- 611
- 8
- 26
0
votes
1 answer
How to print only constraint message from BeanValidationException
I want to print only constraint message but apachecamel printing complete message like
Bean Code part
@NotNull(message="Validation Error name value Missing.")
private String name;
Router Code
onException(BeanValidationException.class)
…

ImranRazaKhan
- 1,955
- 5
- 33
- 74
0
votes
0 answers
Bean validation for java.sql.Timestamp
I am trying to implement custom bean validation for java.sql.Timestamp like below -
@Constraint(validatedBy = { DateTimeValidator.class })
@Target({ ElementType.METHOD, ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
@Documented
public…

springenthusiast
- 403
- 1
- 8
- 30
0
votes
0 answers
ScriptAssert script to read from properties?
I am using ScriptAssert and the script work's fine. Now I would like to move the script to properties file.
I am able to read PONumber.mandatory as part of message. I am unable to read PONumber.mandatory.script as part of script. Any help is…

Sarada Chelluboyena
- 422
- 3
- 16
0
votes
1 answer
Bean Validation update message relating to error
I have the following model class
public class ContactDetail {
@NotNull(message="StartNum cannot be null")
private int startNum;
@NotNull(message="EndNum cannot be null")
private int endNum; }
How would I go about validating the…

obsessiveCookie
- 1,130
- 2
- 18
- 33
0
votes
1 answer
Bean Validation ScriptAssert doesn't work
I am not sure if ScriptAssert can be applied on Field. I am trying the below ScriptAssert but all the time it returns the message "Value is Mandatory" even the _this.OBJSTATE != 'CANCELLED'. Can someone please help??

Sarada Chelluboyena
- 422
- 3
- 16