congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
TypeSafeActivator.getValidatorFactory
Code IndexAdd Tabnine to your IDE (free)

How to use
getValidatorFactory
method
in
org.hibernate.cfg.beanvalidation.TypeSafeActivator

Best Java code snippets using org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory (Showing top 8 results out of 315)

origin: hibernate/hibernate-orm

@SuppressWarnings("UnusedDeclaration")
public static void activate(ActivationContext activationContext) {
  final ValidatorFactory factory;
  try {
    factory = getValidatorFactory( activationContext );
  }
  catch (IntegrationException e) {
    if ( activationContext.getValidationModes().contains( ValidationMode.CALLBACK ) ) {
      throw new IntegrationException( "Bean Validation provider was not available, but 'callback' validation was requested", e );
    }
    if ( activationContext.getValidationModes().contains( ValidationMode.DDL ) ) {
      throw new IntegrationException( "Bean Validation provider was not available, but 'ddl' validation was requested", e );
    }
    LOG.debug( "Unable to acquire Bean Validation ValidatorFactory, skipping activation" );
    return;
  }
  applyRelationalConstraints( factory, activationContext );
  applyCallbackListeners( factory, activationContext );
}
origin: org.hibernate/hibernate-annotations

public static void applyDDL(Collection<PersistentClass> persistentClasses, Properties properties) {
  ValidatorFactory factory = getValidatorFactory( properties );
  Class<?>[] groupsArray = new GroupsPerOperation( properties ).get( GroupsPerOperation.Operation.DDL );
  Set<Class<?>> groups = new HashSet<Class<?>>( Arrays.asList( groupsArray ) );
  for ( PersistentClass persistentClass : persistentClasses ) {
    final String className = persistentClass.getClassName();
    if ( className == null || className.length() == 0) continue;
    Class<?> clazz;
    try {
      clazz = ReflectHelper.classForName( className, TypeSafeActivator.class );
    }
    catch ( ClassNotFoundException e ) {
      throw new AssertionFailure( "Entity class not found", e);
    }
    try {
      applyDDL( "", persistentClass, clazz, factory, groups, true );
    }
    catch (Exception e) {
      logger.warn( "Unable to apply constraints on DDL for " + className, e );
    }
  }
}
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.core

@SuppressWarnings( {"UnusedDeclaration"})
public static void applyDDL(Collection<PersistentClass> persistentClasses, Properties properties, Dialect dialect) {
  ValidatorFactory factory = getValidatorFactory( properties );
  Class<?>[] groupsArray = new GroupsPerOperation( properties ).get( GroupsPerOperation.Operation.DDL );
  Set<Class<?>> groups = new HashSet<Class<?>>( Arrays.asList( groupsArray ) );
  for ( PersistentClass persistentClass : persistentClasses ) {
    final String className = persistentClass.getClassName();
    if ( className == null || className.length() == 0 ) {
      continue;
    }
    Class<?> clazz;
    try {
      clazz = ReflectHelper.classForName( className, TypeSafeActivator.class );
    }
    catch ( ClassNotFoundException e ) {
      throw new AssertionFailure( "Entity class not found", e );
    }
    try {
      applyDDL( "", persistentClass, clazz, factory, groups, true, dialect );
    }
    catch (Exception e) {
      LOG.unableToApplyConstraints( className, e );
    }
  }
}
origin: org.hibernate.orm/hibernate-core

@SuppressWarnings("UnusedDeclaration")
public static void activate(ActivationContext activationContext) {
  final ValidatorFactory factory;
  try {
    factory = getValidatorFactory( activationContext );
  }
  catch (IntegrationException e) {
    if ( activationContext.getValidationModes().contains( ValidationMode.CALLBACK ) ) {
      throw new IntegrationException( "Bean Validation provider was not available, but 'callback' validation was requested", e );
    }
    if ( activationContext.getValidationModes().contains( ValidationMode.DDL ) ) {
      throw new IntegrationException( "Bean Validation provider was not available, but 'ddl' validation was requested", e );
    }
    LOG.debug( "Unable to acquire Bean Validation ValidatorFactory, skipping activation" );
    return;
  }
  applyRelationalConstraints( factory, activationContext );
  applyCallbackListeners( factory, activationContext );
}
origin: org.hibernate/com.springsource.org.hibernate

@SuppressWarnings( {"UnusedDeclaration"})
public static void applyDDL(Collection<PersistentClass> persistentClasses, Properties properties, Dialect dialect) {
  ValidatorFactory factory = getValidatorFactory( properties );
  Class<?>[] groupsArray = new GroupsPerOperation( properties ).get( GroupsPerOperation.Operation.DDL );
  Set<Class<?>> groups = new HashSet<Class<?>>( Arrays.asList( groupsArray ) );
  for ( PersistentClass persistentClass : persistentClasses ) {
    final String className = persistentClass.getClassName();
    if ( className == null || className.length() == 0 ) {
      continue;
    }
    Class<?> clazz;
    try {
      clazz = ReflectHelper.classForName( className, TypeSafeActivator.class );
    }
    catch ( ClassNotFoundException e ) {
      throw new AssertionFailure( "Entity class not found", e );
    }
    try {
      applyDDL( "", persistentClass, clazz, factory, groups, true, dialect );
    }
    catch (Exception e) {
      LOG.unableToApplyConstraints( className, e );
    }
  }
}
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 );
}
org.hibernate.cfg.beanvalidationTypeSafeActivatorgetValidatorFactory

Popular methods of TypeSafeActivator

  • applyConstraints
  • applyDDL
  • applyDigits
  • applyLength
  • applyMax
  • applyMin
  • applyNotNull
  • applySize
  • findPropertyByName
  • applySQLCheck
  • applyCallbackListeners
  • applyRelationalConstraints
  • applyCallbackListeners,
  • applyRelationalConstraints,
  • resolveProvidedFactory,
  • getColumn,
  • isComposite

Popular in Java

  • Start an intent from android
  • runOnUiThread (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • getResourceAsStream (ClassLoader)
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • Permission (java.security)
    Legacy security code; do not use.
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Top 25 Plugins for Webstorm
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