# @Valid annotation

**URL:** <https://discourse.hibernate.org/t/valid-annotation/1757>\
**Category:** Hibernate Validator\
**Created:** [November 20, 2018, 8:32pm UTC](https://discourse.hibernate.org/t/valid-annotation/1757 "2018-11-20T20:32:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ihanna](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/ihanna/32/377_2.png) [@ihanna](https://discourse.hibernate.org/u/ihanna)\
**Post date:** [November 20, 2018, 8:32pm UTC](https://discourse.hibernate.org/t/valid-annotation/1757/1 "2018-11-20T20:32:05Z")

</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 Employee{  
@Valid  
private double age;  
}

Valid.employee.age = Enter valid number

> > it is not work because there is no message attribute in @Valid annotation

so I wait your opinion or may be i miss something ??

---

<div class="post-metadata">

**Author:** ![gsmet](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/gsmet/32/9_2.png) [@gsmet](https://discourse.hibernate.org/u/gsmet)\
**Post date:** [November 28, 2018, 10:21pm UTC](https://discourse.hibernate.org/t/valid-annotation/1757/2 "2018-11-28T22:21:14Z")

</div>

The `@Valid` annotation is used for cascading i.e. when you want to cascade the validation to another bean.

I think you’re trying to use it as a constraint and that’s not what it is used for. Just add constraints to your properties and they will be validated.

---

<div class="post-metadata">

**Author:** ![ihanna](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/ihanna/32/377_2.png) [@ihanna](https://discourse.hibernate.org/u/ihanna)\
**Post date:** [November 28, 2018, 11:53pm UTC](https://discourse.hibernate.org/t/valid-annotation/1757/3 "2018-11-28T23:53:45Z")

</div>

Thanks Gasmet, my case is to validate double property, and after search I found I can use typematch.beanName.property Name = please enter valid number

Thanks and Regards,
