org.hibernate.cfg.beanvalidation
Class BeanValidationEventListener

java.lang.Object
  extended by org.hibernate.cfg.beanvalidation.BeanValidationEventListener
All Implemented Interfaces:
Serializable, PreDeleteEventListener, PreInsertEventListener, PreUpdateEventListener

public class BeanValidationEventListener
extends Object
implements PreInsertEventListener, PreUpdateEventListener, PreDeleteEventListener

Event listener used to enable Bean Validation for insert/update/delete events.

See Also:
Serialized Form

Constructor Summary
BeanValidationEventListener()
          No-arg constructor used when listener is configured via configuration file
BeanValidationEventListener(ValidatorFactory factory, Properties properties)
          Constructor used in an environment where validator factory is injected (JPA2).
 
Method Summary
 void initialize(Configuration cfg)
           
 boolean onPreDelete(PreDeleteEvent event)
          Return true if the operation should be vetoed
 boolean onPreInsert(PreInsertEvent event)
          Return true if the operation should be vetoed
 boolean onPreUpdate(PreUpdateEvent event)
          Return true if the operation should be vetoed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanValidationEventListener

public BeanValidationEventListener()
No-arg constructor used when listener is configured via configuration file


BeanValidationEventListener

public BeanValidationEventListener(ValidatorFactory factory,
                                   Properties properties)
Constructor used in an environment where validator factory is injected (JPA2).

Parameters:
factory - The ValidatorFactory to use to create Validator instance(s)
properties - Configued properties
Method Detail

initialize

public void initialize(Configuration cfg)

onPreInsert

public boolean onPreInsert(PreInsertEvent event)
Description copied from interface: PreInsertEventListener
Return true if the operation should be vetoed

Specified by:
onPreInsert in interface PreInsertEventListener

onPreUpdate

public boolean onPreUpdate(PreUpdateEvent event)
Description copied from interface: PreUpdateEventListener
Return true if the operation should be vetoed

Specified by:
onPreUpdate in interface PreUpdateEventListener

onPreDelete

public boolean onPreDelete(PreDeleteEvent event)
Description copied from interface: PreDeleteEventListener
Return true if the operation should be vetoed

Specified by:
onPreDelete in interface PreDeleteEventListener


Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.