コード例 #1
0
  /**
   * Diese Methode implementiert die Registierung eines neuen Benutzers.
   *
   * @param serviceRegistry - SessionFactoryServiceRegistry(Objekt welches die Registrierung
   *     ermöglicht)
   */
  public static void register(SessionFactoryServiceRegistry serviceRegistry) {
    // System.out.println("Registriere Listener");

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

    eventListenerRegistry.appendListeners(EventType.PRE_INSERT, new SedicoWriteInterceptor());
    eventListenerRegistry.appendListeners(EventType.PRE_UPDATE, new SedicoWriteInterceptor());
    eventListenerRegistry.appendListeners(EventType.PRE_DELETE, new SedicoWriteInterceptor());
    eventListenerRegistry.appendListeners(EventType.PRE_LOAD, new SedicoReadInterceptor());
  }
コード例 #2
0
 private void integrate(
     SessionFactoryServiceRegistry serviceRegistry, SessionFactoryImplementor sessionFactory) {
   if (!sessionFactory.getSettings().isAutoEvictCollectionCache()) {
     // feature is disabled
     return;
   }
   if (!sessionFactory.getSettings().isSecondLevelCacheEnabled()) {
     // Nothing to do, if caching is disabled
     return;
   }
   EventListenerRegistry eventListenerRegistry =
       serviceRegistry.getService(EventListenerRegistry.class);
   eventListenerRegistry.appendListeners(EventType.POST_INSERT, this);
   eventListenerRegistry.appendListeners(EventType.POST_DELETE, this);
   eventListenerRegistry.appendListeners(EventType.POST_UPDATE, this);
 }