Package org.hibernate.cfg.beanvalidation
Class BeanValidationEventListener
- java.lang.Object
-
- org.hibernate.cfg.beanvalidation.BeanValidationEventListener
-
- All Implemented Interfaces:
PreDeleteEventListener,PreInsertEventListener,PreUpdateEventListener
public class BeanValidationEventListener extends Object implements PreInsertEventListener, PreUpdateEventListener, PreDeleteEventListener
Event listener used to enable Bean Validation for insert/update/delete events.
-
-
Constructor Summary
Constructors Constructor Description BeanValidationEventListener(ValidatorFactory factory, Map<String,Object> settings, ClassLoaderService classLoaderService)Constructor used in an environment where validator factory is injected (JPA2).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinitialize(Map<String,Object> settings, ClassLoaderService classLoaderService)booleanonPreDelete(PreDeleteEvent event)Return true if the operation should be vetoedbooleanonPreInsert(PreInsertEvent event)Return true if the operation should be vetoedbooleanonPreUpdate(PreUpdateEvent event)Return true if the operation should be vetoed
-
-
-
Constructor Detail
-
BeanValidationEventListener
public BeanValidationEventListener(ValidatorFactory factory, Map<String,Object> settings, ClassLoaderService classLoaderService)
Constructor used in an environment where validator factory is injected (JPA2).- Parameters:
factory- TheValidatorFactoryto use to createValidatorinstance(s)settings- Configured properties
-
-
Method Detail
-
initialize
public void initialize(Map<String,Object> settings, ClassLoaderService classLoaderService)
-
onPreInsert
public boolean onPreInsert(PreInsertEvent event)
Description copied from interface:PreInsertEventListenerReturn true if the operation should be vetoed- Specified by:
onPreInsertin interfacePreInsertEventListener
-
onPreUpdate
public boolean onPreUpdate(PreUpdateEvent event)
Description copied from interface:PreUpdateEventListenerReturn true if the operation should be vetoed- Specified by:
onPreUpdatein interfacePreUpdateEventListener
-
onPreDelete
public boolean onPreDelete(PreDeleteEvent event)
Description copied from interface:PreDeleteEventListenerReturn true if the operation should be vetoed- Specified by:
onPreDeletein interfacePreDeleteEventListener
-
-