Package org.hibernate.event.service.spi

Examples of org.hibernate.event.service.spi.EventListenerRegistry


  private void attachBatchListenersIfRequired(SessionFactoryServiceRegistry serviceRegistry) {
    GridDialect gridDialect = serviceRegistry.getService( GridDialect.class );
    BatchOperationsDelegator batchDelegator = asBatchDelegatorOrNull( gridDialect );

    if ( batchDelegator != null ) {
      EventListenerRegistry eventListenerRegistry = serviceRegistry.getService( EventListenerRegistry.class );
      addListeners( eventListenerRegistry, batchDelegator );
    }
  }
View Full Code Here


  /**
   * Registers OGM's persist event listeners.
   */
  @TemporaryWorkaround("Only needed until HHH-9451 is fixed upstream")
  private void attachPersistListener(SessionFactoryServiceRegistry serviceRegistry) {
    EventListenerRegistry eventListenerRegistry = serviceRegistry.getService( EventListenerRegistry.class );

    JpaIntegrator integrator = getIntegrator( JpaIntegrator.class, serviceRegistry );
    CallbackRegistry callbackRegistry = integrator != null ? extractCallbackRegistry( integrator ) : null;

    eventListenerRegistry.addDuplicationStrategy( new OgmPersistEventDuplicationStrategy( callbackRegistry ) );

    eventListenerRegistry.getEventListenerGroup( EventType.MERGE ).appendListener( new OgmDefaultMergeEventListener() );
    eventListenerRegistry.getEventListenerGroup( EventType.PERSIST ).appendListener( new OgmDefaultPersistEventListener() );
    eventListenerRegistry.getEventListenerGroup( EventType.PERSIST_ONFLUSH ).appendListener( new OgmDefaultPersistOnFlushEventListener() );
    eventListenerRegistry.getEventListenerGroup( EventType.REPLICATE ).appendListener( new OgmDefaultReplicateEventListener() );
    eventListenerRegistry.getEventListenerGroup( EventType.SAVE ).appendListener( new OgmDefaultSaveEventListener() );
    eventListenerRegistry.getEventListenerGroup( EventType.SAVE_UPDATE ).appendListener( new OgmDefaultSaveOrUpdateEventListener() );
    eventListenerRegistry.getEventListenerGroup( EventType.UPDATE ).appendListener( new OgmDefaultUpdateEventListener() );
    eventListenerRegistry.getEventListenerGroup( EventType.MERGE ).appendListener( new OgmJpaMergeEventListener() );
    eventListenerRegistry.getEventListenerGroup( EventType.PERSIST ).appendListener( new OgmJpaPersistEventListener() );
    eventListenerRegistry.getEventListenerGroup( EventType.PERSIST_ONFLUSH ).appendListener( new OgmJpaPersistOnFlushEventListener() );
    eventListenerRegistry.getEventListenerGroup( EventType.SAVE ).appendListener( new OgmJpaSaveEventListener() );
    eventListenerRegistry.getEventListenerGroup( EventType.SAVE_UPDATE ).appendListener( new OgmJpaSaveOrUpdateEventListener() );
  }
View Full Code Here

  private void attachBatchListenersIfRequired(SessionFactoryServiceRegistry serviceRegistry) {
    GridDialect gridDialect = serviceRegistry.getService( GridDialect.class );
    BatchOperationsDelegator batchDelegator = asBatchDelegatorOrNull( gridDialect );

    if ( batchDelegator != null ) {
      EventListenerRegistry eventListenerRegistry = serviceRegistry.getService( EventListenerRegistry.class );
      addListeners( eventListenerRegistry, batchDelegator );
    }
  }
View Full Code Here

  private Map<String, List<Object>> eventListeners;

  public void init() {

    EventListenerRegistry eventListenerRegistry = ((SessionFactoryImpl) sessionFactory)
        .getServiceRegistry().getService(EventListenerRegistry.class);

    // If you wish to have custom determination and handling of "duplicate"
    // listeners, you would have to add an
    // implementation of the
    // org.hibernate.event.service.spi.DuplicationStrategy contract like
    // this
    // eventListenerRegistry.addDuplicationStrategy( myDuplicationStrategy
    // );
    // EventListenerRegistry defines 3 ways to register listeners:
    // 1) This form overrides any existing registrations with
    // eventListenerRegistry.setListeners( EventType.AUTO_FLUSH,
    // myCompleteSetOfListeners );
    // 2) This form adds the specified listener(s) to the beginning of the
    // listener chain
    // eventListenerRegistry.prependListeners( EventType.AUTO_FLUSH,
    // myListenersToBeCalledFirst );
    // 3) This form adds the specified listener(s) to the end of the
    // listener chain
    // eventListenerRegistry.appendListeners( EventType.AUTO_FLUSH,
    // myListenersToBeCalledLast );

    for (String eTypeStr : eventListeners.keySet()) {
      EventType eType = EventType.resolveEventTypeByName(eTypeStr);
      for (Object listener : eventListeners.get(eTypeStr)) {
        eventListenerRegistry.setListeners(eType, listener);
      }
    }

  }
View Full Code Here

        }
    );


    // then prepare listeners
    final EventListenerRegistry eventListenerRegistry = serviceRegistry.getService( EventListenerRegistry.class );

    eventListenerRegistry.addDuplicationStrategy( JPA_DUPLICATION_STRATEGY );

    // op listeners
    eventListenerRegistry.setListeners( EventType.AUTO_FLUSH, JpaAutoFlushEventListener.INSTANCE );
    eventListenerRegistry.setListeners( EventType.DELETE, new JpaDeleteEventListener() );
    eventListenerRegistry.setListeners( EventType.FLUSH_ENTITY, new JpaFlushEntityEventListener() );
    eventListenerRegistry.setListeners( EventType.FLUSH, JpaFlushEventListener.INSTANCE );
    eventListenerRegistry.setListeners( EventType.MERGE, new JpaMergeEventListener() );
    eventListenerRegistry.setListeners( EventType.PERSIST, new JpaPersistEventListener() );
    eventListenerRegistry.setListeners( EventType.PERSIST_ONFLUSH, new JpaPersistOnFlushEventListener() );
    eventListenerRegistry.setListeners( EventType.SAVE, new JpaSaveEventListener() );
    eventListenerRegistry.setListeners( EventType.SAVE_UPDATE, new JpaSaveOrUpdateEventListener() );

    // post op listeners
    eventListenerRegistry.prependListeners( EventType.POST_DELETE, new JpaPostDeleteEventListener() );
    eventListenerRegistry.prependListeners( EventType.POST_INSERT, new JpaPostInsertEventListener() );
    eventListenerRegistry.prependListeners( EventType.POST_LOAD, new JpaPostLoadEventListener() );
    eventListenerRegistry.prependListeners( EventType.POST_UPDATE, new JpaPostUpdateEventListener() );

    for ( Map.Entry<?,?> entry : configuration.getProperties().entrySet() ) {
      if ( ! String.class.isInstance( entry.getKey() ) ) {
        continue;
      }
      final String propertyName = (String) entry.getKey();
      if ( ! propertyName.startsWith( AvailableSettings.EVENT_LISTENER_PREFIX ) ) {
        continue;
      }
      final String eventTypeName = propertyName.substring( AvailableSettings.EVENT_LISTENER_PREFIX.length() + 1 );
      final EventType eventType = EventType.resolveEventTypeByName( eventTypeName );
      final EventListenerGroup eventListenerGroup = eventListenerRegistry.getEventListenerGroup( eventType );
      for ( String listenerImpl : ( (String) entry.getValue() ).split( " ," ) ) {
        eventListenerGroup.appendListener( instantiate( listenerImpl, serviceRegistry ) );
      }
    }

    // handle JPA "entity listener classes"...

    this.callbackRegistry = new CallbackRegistryImpl();
    final Object beanManagerRef = configuration.getProperties().get( AvailableSettings.CDI_BEAN_MANAGER );
    this.jpaListenerFactory = beanManagerRef == null
        ? new StandardListenerFactory()
        : buildBeanManagerListenerFactory( beanManagerRef );
    this.callbackProcessor = new LegacyCallbackProcessor( jpaListenerFactory, configuration.getReflectionManager() );

    Iterator classes = configuration.getClassMappings();
    while ( classes.hasNext() ) {
      final PersistentClass clazz = (PersistentClass) classes.next();
      if ( clazz.getClassName() == null ) {
        // we can have non java class persisted by hibernate
        continue;
      }
      callbackProcessor.processCallbacksForEntity( clazz.getClassName(), callbackRegistry );
    }

    for ( EventType eventType : EventType.values() ) {
      final EventListenerGroup eventListenerGroup = eventListenerRegistry.getEventListenerGroup( eventType );
      for ( Object listener : eventListenerGroup.listeners() ) {
        if ( CallbackRegistryConsumer.class.isInstance( listener ) ) {
          ( (CallbackRegistryConsumer) listener ).injectCallbackRegistry( callbackRegistry );
        }
      }
View Full Code Here

          }
        }
    );

    // then prepare listeners
        final EventListenerRegistry eventListenerRegistry = serviceRegistry.getService( EventListenerRegistry.class );

        eventListenerRegistry.addDuplicationStrategy( JPA_DUPLICATION_STRATEGY );

        // op listeners
        eventListenerRegistry.setListeners( EventType.AUTO_FLUSH, JpaAutoFlushEventListener.INSTANCE );
        eventListenerRegistry.setListeners( EventType.DELETE, new JpaDeleteEventListener() );
        eventListenerRegistry.setListeners( EventType.FLUSH_ENTITY, new JpaFlushEntityEventListener() );
        eventListenerRegistry.setListeners( EventType.FLUSH, JpaFlushEventListener.INSTANCE );
        eventListenerRegistry.setListeners( EventType.MERGE, new JpaMergeEventListener() );
        eventListenerRegistry.setListeners( EventType.PERSIST, new JpaPersistEventListener() );
        eventListenerRegistry.setListeners( EventType.PERSIST_ONFLUSH, new JpaPersistOnFlushEventListener() );
        eventListenerRegistry.setListeners( EventType.SAVE, new JpaSaveEventListener() );
        eventListenerRegistry.setListeners( EventType.SAVE_UPDATE, new JpaSaveOrUpdateEventListener() );

        // post op listeners
        eventListenerRegistry.prependListeners( EventType.POST_DELETE, new JpaPostDeleteEventListener() );
        eventListenerRegistry.prependListeners( EventType.POST_INSERT, new JpaPostInsertEventListener() );
        eventListenerRegistry.prependListeners( EventType.POST_LOAD, new JpaPostLoadEventListener() );
        eventListenerRegistry.prependListeners( EventType.POST_UPDATE, new JpaPostUpdateEventListener() );

        for ( Map.Entry<?,?> entry : sessionFactory.getProperties().entrySet() ) {
            if ( ! String.class.isInstance( entry.getKey() ) ) {
                continue;
            }
            final String propertyName = (String) entry.getKey();
            if ( ! propertyName.startsWith( AvailableSettings.EVENT_LISTENER_PREFIX ) ) {
                continue;
            }
            final String eventTypeName = propertyName.substring( AvailableSettings.EVENT_LISTENER_PREFIX.length() + 1 );
            final EventType eventType = EventType.resolveEventTypeByName( eventTypeName );
            final EventListenerGroup eventListenerGroup = eventListenerRegistry.getEventListenerGroup( eventType );
            for ( String listenerImpl : ( (String) entry.getValue() ).split( " ," ) ) {
                eventListenerGroup.appendListener( instantiate( listenerImpl, serviceRegistry ) );
            }
        }

    // handle JPA "entity listener classes"...

    this.callbackRegistry = new CallbackRegistryImpl();
    final Object beanManagerRef = sessionFactory.getProperties().get( AvailableSettings.CDI_BEAN_MANAGER );
    this.jpaListenerFactory = beanManagerRef == null
        ? new StandardListenerFactory()
        : buildBeanManagerListenerFactory( beanManagerRef );
    this.callbackProcessor = new CallbackProcessorImpl( jpaListenerFactory, metadata, serviceRegistry );

        for ( EntityBinding binding : metadata.getEntityBindings() ) {
      callbackProcessor.processCallbacksForEntity( binding, callbackRegistry );
        }

        for ( EventType eventType : EventType.values() ) {
            final EventListenerGroup eventListenerGroup = eventListenerRegistry.getEventListenerGroup( eventType );
            for ( Object listener : eventListenerGroup.listeners() ) {
                if ( CallbackRegistryConsumer.class.isInstance( listener ) ) {
                    ( (CallbackRegistryConsumer) listener ).injectCallbackRegistry( callbackRegistry );
                }
            }
View Full Code Here

      for ( GrantedPermission declaration : permissionDeclarations.getPermissionDeclarations() ) {
        jaccService.addPermission( declaration );
      }
    }

    final EventListenerRegistry eventListenerRegistry = serviceRegistry.getService( EventListenerRegistry.class );
    eventListenerRegistry.addDuplicationStrategy( DUPLICATION_STRATEGY );

    eventListenerRegistry.prependListeners( EventType.PRE_DELETE, new JaccPreDeleteEventListener() );
    eventListenerRegistry.prependListeners( EventType.PRE_INSERT, new JaccPreInsertEventListener() );
    eventListenerRegistry.prependListeners( EventType.PRE_UPDATE, new JaccPreUpdateEventListener() );
    eventListenerRegistry.prependListeners( EventType.PRE_LOAD, new JaccPreLoadEventListener() );
  }
View Full Code Here

  @SuppressWarnings( {"unchecked"})
  public void integrate(
      Configuration configuration,
      SessionFactoryImplementor sessionFactory,
      SessionFactoryServiceRegistry serviceRegistry) {
    final EventListenerRegistry eventListenerRegistry = serviceRegistry.getService( EventListenerRegistry.class );

    boolean isSecurityEnabled = configuration.getProperties().containsKey( AvailableSettings.JACC_ENABLED );

    eventListenerRegistry.addDuplicationStrategy( JPA_DUPLICATION_STRATEGY );
    eventListenerRegistry.addDuplicationStrategy( JACC_DUPLICATION_STRATEGY );

    // op listeners
    eventListenerRegistry.setListeners( EventType.AUTO_FLUSH, EJB3AutoFlushEventListener.INSTANCE );
    eventListenerRegistry.setListeners( EventType.DELETE, new EJB3DeleteEventListener() );
    eventListenerRegistry.setListeners( EventType.FLUSH_ENTITY, new EJB3FlushEntityEventListener() );
    eventListenerRegistry.setListeners( EventType.FLUSH, EJB3FlushEventListener.INSTANCE );
    eventListenerRegistry.setListeners( EventType.MERGE, new EJB3MergeEventListener() );
    eventListenerRegistry.setListeners( EventType.PERSIST, new EJB3PersistEventListener() );
    eventListenerRegistry.setListeners( EventType.PERSIST_ONFLUSH, new EJB3PersistOnFlushEventListener() );
    eventListenerRegistry.setListeners( EventType.SAVE, new EJB3SaveEventListener() );
    eventListenerRegistry.setListeners( EventType.SAVE_UPDATE, new EJB3SaveOrUpdateEventListener() );

    // pre op listeners
    if ( isSecurityEnabled ) {
      final String jaccContextId = configuration.getProperty( Environment.JACC_CONTEXTID );
      eventListenerRegistry.prependListeners( EventType.PRE_DELETE, new JACCPreDeleteEventListener(jaccContextId) );
      eventListenerRegistry.prependListeners( EventType.PRE_INSERT, new JACCPreInsertEventListener(jaccContextId) );
      eventListenerRegistry.prependListeners( EventType.PRE_UPDATE, new JACCPreUpdateEventListener(jaccContextId) );
      eventListenerRegistry.prependListeners( EventType.PRE_LOAD, new JACCPreLoadEventListener(jaccContextId) );
    }

    // post op listeners
    eventListenerRegistry.prependListeners( EventType.POST_DELETE, new EJB3PostDeleteEventListener() );
    eventListenerRegistry.prependListeners( EventType.POST_INSERT, new EJB3PostInsertEventListener() );
    eventListenerRegistry.prependListeners( EventType.POST_LOAD, new EJB3PostLoadEventListener() );
    eventListenerRegistry.prependListeners( EventType.POST_UPDATE, new EJB3PostUpdateEventListener() );

    for ( Map.Entry<?,?> entry : configuration.getProperties().entrySet() ) {
      if ( ! String.class.isInstance( entry.getKey() ) ) {
        continue;
      }
      final String propertyName = (String) entry.getKey();
      if ( ! propertyName.startsWith( AvailableSettings.EVENT_LISTENER_PREFIX ) ) {
        continue;
      }
      final String eventTypeName = propertyName.substring( AvailableSettings.EVENT_LISTENER_PREFIX.length() + 1 );
      final EventType eventType = EventType.resolveEventTypeByName( eventTypeName );
      final EventListenerGroup eventListenerGroup = eventListenerRegistry.getEventListenerGroup( eventType );
      for ( String listenerImpl : ( (String) entry.getValue() ).split( " ," ) ) {
        eventListenerGroup.appendListener( instantiate( listenerImpl, serviceRegistry ) );
      }
    }

    final EntityCallbackHandler callbackHandler = new EntityCallbackHandler();
    Iterator classes = configuration.getClassMappings();
    ReflectionManager reflectionManager = configuration.getReflectionManager();
    while ( classes.hasNext() ) {
      PersistentClass clazz = (PersistentClass) classes.next();
      if ( clazz.getClassName() == null ) {
        //we can have non java class persisted by hibernate
        continue;
      }
      try {
        callbackHandler.add( reflectionManager.classForName( clazz.getClassName(), this.getClass() ), reflectionManager );
      }
      catch (ClassNotFoundException e) {
        throw new MappingException( "entity class not found: " + clazz.getNodeName(), e );
      }
    }

    for ( EventType eventType : EventType.values() ) {
      final EventListenerGroup eventListenerGroup = eventListenerRegistry.getEventListenerGroup( eventType );
      for ( Object listener : eventListenerGroup.listeners() ) {
        if ( CallbackHandlerConsumer.class.isInstance( listener ) ) {
          ( (CallbackHandlerConsumer) listener ).setCallbackHandler( callbackHandler );
        }
      }
View Full Code Here

   */
  @Override
  public void integrate( MetadataImplementor metadata,
                         SessionFactoryImplementor sessionFactory,
                         SessionFactoryServiceRegistry serviceRegistry ) {
        final EventListenerRegistry eventListenerRegistry = serviceRegistry.getService( EventListenerRegistry.class );

        boolean isSecurityEnabled = sessionFactory.getProperties().containsKey( AvailableSettings.JACC_ENABLED );

        eventListenerRegistry.addDuplicationStrategy( JPA_DUPLICATION_STRATEGY );
        eventListenerRegistry.addDuplicationStrategy( JACC_DUPLICATION_STRATEGY );

        // op listeners
        eventListenerRegistry.setListeners( EventType.AUTO_FLUSH, EJB3AutoFlushEventListener.INSTANCE );
        eventListenerRegistry.setListeners( EventType.DELETE, new EJB3DeleteEventListener() );
        eventListenerRegistry.setListeners( EventType.FLUSH_ENTITY, new EJB3FlushEntityEventListener() );
        eventListenerRegistry.setListeners( EventType.FLUSH, EJB3FlushEventListener.INSTANCE );
        eventListenerRegistry.setListeners( EventType.MERGE, new EJB3MergeEventListener() );
        eventListenerRegistry.setListeners( EventType.PERSIST, new EJB3PersistEventListener() );
        eventListenerRegistry.setListeners( EventType.PERSIST_ONFLUSH, new EJB3PersistOnFlushEventListener() );
        eventListenerRegistry.setListeners( EventType.SAVE, new EJB3SaveEventListener() );
        eventListenerRegistry.setListeners( EventType.SAVE_UPDATE, new EJB3SaveOrUpdateEventListener() );

        // pre op listeners
        if ( isSecurityEnabled ) {
            final String jaccContextId = sessionFactory.getProperties().getProperty( Environment.JACC_CONTEXTID );
            eventListenerRegistry.prependListeners( EventType.PRE_DELETE, new JACCPreDeleteEventListener(jaccContextId) );
            eventListenerRegistry.prependListeners( EventType.PRE_INSERT, new JACCPreInsertEventListener(jaccContextId) );
            eventListenerRegistry.prependListeners( EventType.PRE_UPDATE, new JACCPreUpdateEventListener(jaccContextId) );
            eventListenerRegistry.prependListeners( EventType.PRE_LOAD, new JACCPreLoadEventListener(jaccContextId) );
        }

        // post op listeners
        eventListenerRegistry.prependListeners( EventType.POST_DELETE, new EJB3PostDeleteEventListener() );
        eventListenerRegistry.prependListeners( EventType.POST_INSERT, new EJB3PostInsertEventListener() );
        eventListenerRegistry.prependListeners( EventType.POST_LOAD, new EJB3PostLoadEventListener() );
        eventListenerRegistry.prependListeners( EventType.POST_UPDATE, new EJB3PostUpdateEventListener() );

        for ( Map.Entry<?,?> entry : sessionFactory.getProperties().entrySet() ) {
            if ( ! String.class.isInstance( entry.getKey() ) ) {
                continue;
            }
            final String propertyName = (String) entry.getKey();
            if ( ! propertyName.startsWith( AvailableSettings.EVENT_LISTENER_PREFIX ) ) {
                continue;
            }
            final String eventTypeName = propertyName.substring( AvailableSettings.EVENT_LISTENER_PREFIX.length() + 1 );
            final EventType eventType = EventType.resolveEventTypeByName( eventTypeName );
            final EventListenerGroup eventListenerGroup = eventListenerRegistry.getEventListenerGroup( eventType );
            for ( String listenerImpl : ( (String) entry.getValue() ).split( " ," ) ) {
                eventListenerGroup.appendListener( instantiate( listenerImpl, serviceRegistry ) );
            }
        }

View Full Code Here

                new PersistCascadeStyle()
    );


    // then prepare listeners
    final EventListenerRegistry eventListenerRegistry = serviceRegistry.getService( EventListenerRegistry.class );

    eventListenerRegistry.addDuplicationStrategy( JPA_DUPLICATION_STRATEGY );

    // op listeners
    eventListenerRegistry.setListeners( EventType.AUTO_FLUSH, JpaAutoFlushEventListener.INSTANCE );
    eventListenerRegistry.setListeners( EventType.DELETE, new JpaDeleteEventListener() );
    eventListenerRegistry.setListeners( EventType.FLUSH_ENTITY, new JpaFlushEntityEventListener() );
    eventListenerRegistry.setListeners( EventType.FLUSH, JpaFlushEventListener.INSTANCE );
    eventListenerRegistry.setListeners( EventType.MERGE, new JpaMergeEventListener() );
    eventListenerRegistry.setListeners( EventType.PERSIST, new JpaPersistEventListener() );
    eventListenerRegistry.setListeners( EventType.PERSIST_ONFLUSH, new JpaPersistOnFlushEventListener() );
    eventListenerRegistry.setListeners( EventType.SAVE, new JpaSaveEventListener() );
    eventListenerRegistry.setListeners( EventType.SAVE_UPDATE, new JpaSaveOrUpdateEventListener() );

    // post op listeners
    eventListenerRegistry.prependListeners( EventType.POST_DELETE, new JpaPostDeleteEventListener() );
    eventListenerRegistry.prependListeners( EventType.POST_INSERT, new JpaPostInsertEventListener() );
    eventListenerRegistry.prependListeners( EventType.POST_LOAD, new JpaPostLoadEventListener() );
    eventListenerRegistry.prependListeners( EventType.POST_UPDATE, new JpaPostUpdateEventListener() );

    for ( Map.Entry<?,?> entry : configuration.getProperties().entrySet() ) {
      if ( ! String.class.isInstance( entry.getKey() ) ) {
        continue;
      }
      final String propertyName = (String) entry.getKey();
      if ( ! propertyName.startsWith( AvailableSettings.EVENT_LISTENER_PREFIX ) ) {
        continue;
      }
      final String eventTypeName = propertyName.substring( AvailableSettings.EVENT_LISTENER_PREFIX.length() + 1 );
      final EventType eventType = EventType.resolveEventTypeByName( eventTypeName );
      final EventListenerGroup eventListenerGroup = eventListenerRegistry.getEventListenerGroup( eventType );
      for ( String listenerImpl : ( (String) entry.getValue() ).split( " ," ) ) {
        eventListenerGroup.appendListener( instantiate( listenerImpl, serviceRegistry ) );
      }
    }

    // handle JPA "entity listener classes"...

    this.callbackRegistry = new CallbackRegistryImpl();
    final Object beanManagerRef = configuration.getProperties().get( AvailableSettings.CDI_BEAN_MANAGER );
    this.jpaListenerFactory = beanManagerRef == null
        ? new StandardListenerFactory()
        : buildBeanManagerListenerFactory( beanManagerRef );
    this.callbackProcessor = new LegacyCallbackProcessor( jpaListenerFactory, configuration.getReflectionManager() );

    Iterator classes = configuration.getClassMappings();
    while ( classes.hasNext() ) {
      final PersistentClass clazz = (PersistentClass) classes.next();
      if ( clazz.getClassName() == null ) {
        // we can have non java class persisted by hibernate
        continue;
      }
      callbackProcessor.processCallbacksForEntity( clazz.getClassName(), callbackRegistry );
    }

    for ( EventType eventType : EventType.values() ) {
      final EventListenerGroup eventListenerGroup = eventListenerRegistry.getEventListenerGroup( eventType );
      for ( Object listener : eventListenerGroup.listeners() ) {
        if ( CallbackRegistryConsumer.class.isInstance( listener ) ) {
          ( (CallbackRegistryConsumer) listener ).injectCallbackRegistry( callbackRegistry );
        }
      }
View Full Code Here

TOP

Related Classes of org.hibernate.event.service.spi.EventListenerRegistry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.