List of usage examples for javax.persistence ValidationMode NONE
ValidationMode NONE
To view the source code for javax.persistence ValidationMode NONE.
Click Source Link
From source file:org.apache.openjpa.persistence.validation.ValidatorImpl.java
/** * Common setup code factored out of the constructors *//*from w w w.ja v a 2s.c o m*/ private void initialize() { // only try setting up a validator if mode is not NONE if (_mode != ValidationMode.NONE) { if (_validatorFactory == null) { _validatorFactory = getDefaultValidatorFactory(); } if (_validatorFactory != null) { // use our TraversableResolver instead of BV provider one _validator = _validatorFactory.usingContext().traversableResolver(new TraversableResolverImpl()) .getValidator(); } else { // A default ValidatorFactory could not be created. throw new RuntimeException(_loc.get("no-default-factory").getMessage()); } // throw an exception if we have no Validator if (_validator == null) { // A Validator provider could not be created. throw new RuntimeException(_loc.get("no-validator").getMessage()); } if (_conf != null) { addValidationGroup(JPAProperties.VALIDATE_PRE_PERSIST, _conf.getValidationGroupPrePersist()); addValidationGroup(JPAProperties.VALIDATE_PRE_UPDATE, _conf.getValidationGroupPreUpdate()); addValidationGroup(JPAProperties.VALIDATE_PRE_REMOVE, _conf.getValidationGroupPreRemove()); } else { // add in default validation groups, which can be over-ridden later addDefaultValidationGroups(); } } else { // A Validator should not be created based on the supplied ValidationMode. throw new RuntimeException(_loc.get("no-validation").getMessage()); } }