views:

267

answers:

1

NetBeans let me choose between three values for the JPA validation strategy: Auto, Callback and None. What does "Auto" mean? Does "Callback" mean the use of @PrePersist, @PreUpdate, and @PreRemove?

Is there a performance hit if I use Auto or Callback if there is no validation to perform?

+3  A: 

The JPA 2.0 Spec (JSR 317) does not require a Bean Validation (JSR-303) implementation. Validation is optional. Thus, javax.persistence.ValidationMode can take different values:

  • Auto (default) - if a validation provider is available, then validation should occur
  • Callback - validation is required and a PersistenceException must be thrown if a provider cannot be obtained
  • None - no validation should be attempted and the lack of a validation provider should not cause an exception

This should answer all your questions.

Pascal Thivent