We're updating the issue view to help you get more done. 

Field-level constraint performance impairment

Description

Using Hibernate Validator to validate all Strings fields in an entity as we pull data from our Oracle database.

There is a significant slow down when performing field-level validation on a collection of entities with multiple field constraints.

While retrieving ~72,000 entities from the database, each with 8 constraints, it takes 47 seconds to perform validation (only 3 seconds to retrieve data from the database).
Using only custom constraints and using only built-in constraints (@NotNull) show the same performance issue.
Some debugging shows that 46.5 seconds is spent after calling Validator.validate() and before reaching isValid().

However, when setting the annotation at class-level, manually performing the required reflection and string validation on the entity inside isValid(), it only takes 0.5 seconds to complete validation for all 72,000 entities.

Hibernate should be able to naively handle this magnitude of field-level validations without resorting to manual validation at a class-level.

Environment

Hibernate Validator 5.1.3
EclipseLink 2.5.2
JPA 2.0
JDK 1.7.0 u65

Status

Assignee

Guillaume Smet

Reporter

Andre Hernandez

Worked in

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Community Help Wanted

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Fix versions

Affects versions

5.1.3.Final

Priority

Major