congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
BeanValidationEventListener.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.hibernate.cfg.beanvalidation.BeanValidationEventListener
constructor

Best Java code snippets using org.hibernate.cfg.beanvalidation.BeanValidationEventListener.<init> (Showing top 5 results out of 315)

origin: hibernate/hibernate-orm

@SuppressWarnings( {"UnusedDeclaration"})
public static void applyCallbackListeners(ValidatorFactory validatorFactory, ActivationContext activationContext) {
  final Set<ValidationMode> modes = activationContext.getValidationModes();
  if ( ! ( modes.contains( ValidationMode.CALLBACK ) || modes.contains( ValidationMode.AUTO ) ) ) {
    return;
  }
  final ConfigurationService cfgService = activationContext.getServiceRegistry().getService( ConfigurationService.class );
  final ClassLoaderService classLoaderService = activationContext.getServiceRegistry().getService( ClassLoaderService.class );
  // de-activate not-null tracking at the core level when Bean Validation is present unless the user explicitly
  // asks for it
  if ( cfgService.getSettings().get( Environment.CHECK_NULLABILITY ) == null ) {
    activationContext.getSessionFactory().getSessionFactoryOptions().setCheckNullability( false );
  }
  final BeanValidationEventListener listener = new BeanValidationEventListener(
      validatorFactory,
      cfgService.getSettings(),
      classLoaderService
  );
  final EventListenerRegistry listenerRegistry = activationContext.getServiceRegistry()
      .getService( EventListenerRegistry.class );
  listenerRegistry.addDuplicationStrategy( DuplicationStrategyImpl.INSTANCE );
  listenerRegistry.appendListeners( EventType.PRE_INSERT, listener );
  listenerRegistry.appendListeners( EventType.PRE_UPDATE, listener );
  listenerRegistry.appendListeners( EventType.PRE_DELETE, listener );
  listener.initialize( cfgService.getSettings(), classLoaderService );
}
origin: org.hibernate/hibernate-annotations

public static void activateBeanValidation(EventListeners eventListeners, Properties properties) {
  ValidatorFactory factory = getValidatorFactory( properties );
  BeanValidationEventListener beanValidationEventListener = new BeanValidationEventListener( factory, properties );
  {
    PreInsertEventListener[] listeners = eventListeners.getPreInsertEventListeners();
    int length = listeners.length + 1;
    PreInsertEventListener[] newListeners = new PreInsertEventListener[length];
    System.arraycopy( listeners, 0, newListeners, 0, length - 1 );
    newListeners[length - 1] = beanValidationEventListener;
    eventListeners.setPreInsertEventListeners( newListeners );
  }
  {
    PreUpdateEventListener[] listeners = eventListeners.getPreUpdateEventListeners();
    int length = listeners.length + 1;
    PreUpdateEventListener[] newListeners = new PreUpdateEventListener[length];
    System.arraycopy( listeners, 0, newListeners, 0, length - 1 );
    newListeners[length - 1] = beanValidationEventListener;
    eventListeners.setPreUpdateEventListeners( newListeners );
  }
  {
    PreDeleteEventListener[] listeners = eventListeners.getPreDeleteEventListeners();
    int length = listeners.length + 1;
    PreDeleteEventListener[] newListeners = new PreDeleteEventListener[length];
    System.arraycopy( listeners, 0, newListeners, 0, length - 1 );
    newListeners[length - 1] = beanValidationEventListener;
    eventListeners.setPreDeleteEventListeners( newListeners );
  }
}
origin: org.hibernate/com.springsource.org.hibernate

@SuppressWarnings( {"UnusedDeclaration"})
public static void activateBeanValidation(EventListenerRegistry listenerRegistry, Configuration configuration) {
  final Properties properties = configuration.getProperties();
  ValidatorFactory factory = getValidatorFactory( properties );
  BeanValidationEventListener listener = new BeanValidationEventListener(
      factory, properties
  );
  listenerRegistry.addDuplicationStrategy( DuplicationStrategyImpl.INSTANCE );
  listenerRegistry.appendListeners( EventType.PRE_INSERT, listener );
  listenerRegistry.appendListeners( EventType.PRE_UPDATE, listener );
  listenerRegistry.appendListeners( EventType.PRE_DELETE, listener );
  listener.initialize( configuration );
}
origin: org.hibernate/com.springsource.org.hibernate.core

@SuppressWarnings( {"UnusedDeclaration"})
public static void activateBeanValidation(EventListenerRegistry listenerRegistry, Configuration configuration) {
  final Properties properties = configuration.getProperties();
  ValidatorFactory factory = getValidatorFactory( properties );
  BeanValidationEventListener listener = new BeanValidationEventListener(
      factory, properties
  );
  listenerRegistry.addDuplicationStrategy( DuplicationStrategyImpl.INSTANCE );
  listenerRegistry.appendListeners( EventType.PRE_INSERT, listener );
  listenerRegistry.appendListeners( EventType.PRE_UPDATE, listener );
  listenerRegistry.appendListeners( EventType.PRE_DELETE, listener );
  listener.initialize( configuration );
}
origin: org.hibernate.orm/hibernate-core

@SuppressWarnings( {"UnusedDeclaration"})
public static void applyCallbackListeners(ValidatorFactory validatorFactory, ActivationContext activationContext) {
  final Set<ValidationMode> modes = activationContext.getValidationModes();
  if ( ! ( modes.contains( ValidationMode.CALLBACK ) || modes.contains( ValidationMode.AUTO ) ) ) {
    return;
  }
  final ConfigurationService cfgService = activationContext.getServiceRegistry().getService( ConfigurationService.class );
  final ClassLoaderService classLoaderService = activationContext.getServiceRegistry().getService( ClassLoaderService.class );
  // de-activate not-null tracking at the core level when Bean Validation is present unless the user explicitly
  // asks for it
  if ( cfgService.getSettings().get( Environment.CHECK_NULLABILITY ) == null ) {
    activationContext.getSessionFactory().getSessionFactoryOptions().setCheckNullability( false );
  }
  final BeanValidationEventListener listener = new BeanValidationEventListener(
      validatorFactory,
      cfgService.getSettings(),
      classLoaderService
  );
  final EventListenerRegistry listenerRegistry = activationContext.getServiceRegistry()
      .getService( EventListenerRegistry.class );
  listenerRegistry.addDuplicationStrategy( DuplicationStrategyImpl.INSTANCE );
  listenerRegistry.appendListeners( EventType.PRE_INSERT, listener );
  listenerRegistry.appendListeners( EventType.PRE_UPDATE, listener );
  listenerRegistry.appendListeners( EventType.PRE_DELETE, listener );
  listener.initialize( cfgService.getSettings(), classLoaderService );
}
org.hibernate.cfg.beanvalidationBeanValidationEventListener<init>

Javadoc

No-arg constructor used when listener is configured via configuration file

Popular methods of BeanValidationEventListener

  • init
  • toString
  • validate
  • initialize

Popular in Java

  • Running tasks concurrently on multiple threads
  • getSystemService (Context)
  • getContentResolver (Context)
  • runOnUiThread (Activity)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • JTable (javax.swing)
  • Sublime Text for Python
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now