Hibernate 4.3.11 (and other Versions) should pay attention to Validation Annotations. - so you maybe have to upgrade
This are cites from Hibernate 4.3.11 manual
Chapter 22.Additional modules
Hibernate Core also offers integration with some external
modules/projects. This includes Hibernate Validator the reference
implementation of Bean Validation (JSR 303) and Hibernate Search.
Chapter 22.1 Bean Validation
...
The integration between Hibernate and Bean Validation works at two
levels. First, it is able to check in-memory instances of a class for
constraint violations. Second, it can apply the constraints to the
Hibernate metamodel and incorporate them into the generated database
schema.
...
Chapter 22.1.4 Database schema
Hibernate uses Bean Validation constraints to generate an accurate database schema:
@NotNull leads to a not null column (unless it conflicts with components or table inheritance)
@Size.max leads to a varchar(max) definition for Strings
@Min, @Max lead to column checks (like value <= max)
@Digits leads to the definition of precision and scale (ever wondered which is which? It's easy now with @Digits :) )
Note: @Lengh works too, like @Size
When you use Hibernate Validator 5.1 - then you also need an el-Implementation. For example
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>el-impl</artifactId>
<version>2.2</version>
</dependency>
If you do not have this, then Hibernate ORM will not been able to start Hibernate Validation, ad therefore it would not take (all) JSR-303 for example @Length
, @Size
in account!