当前位置: 首页>>代码示例>>Java>>正文


Java SessionFactoryServiceRegistry类代码示例

本文整理汇总了Java中org.hibernate.service.spi.SessionFactoryServiceRegistry的典型用法代码示例。如果您正苦于以下问题:Java SessionFactoryServiceRegistry类的具体用法?Java SessionFactoryServiceRegistry怎么用?Java SessionFactoryServiceRegistry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SessionFactoryServiceRegistry类属于org.hibernate.service.spi包,在下文中一共展示了SessionFactoryServiceRegistry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: integrate

import org.hibernate.service.spi.SessionFactoryServiceRegistry; //导入依赖的package包/类
@Override
public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
    EventListenerRegistry service = serviceRegistry.getService(org.hibernate.event.service.spi.EventListenerRegistry.class);

    StandardPBEStringEncryptor encrypt = new StandardPBEStringEncryptor();
    encrypt.setPassword("test_password");
    RenderedMessageEncryptEventListener encryptListener = new RenderedMessageEncryptEventListener();
    encryptListener.setStringEncryptor(encrypt);

    RenderedMessageDecryptEventListener decryptListener = new RenderedMessageDecryptEventListener();
    decryptListener.setStringEncryptor(encrypt);

    FullTextIndexEventListener fullTextListener = new FullTextIndexEventListener();

    service.appendListeners(EventType.PRE_UPDATE, encryptListener);
    service.prependListeners(EventType.POST_UPDATE, decryptListener);
    service.appendListeners(EventType.PRE_INSERT, encryptListener);
    service.prependListeners(EventType.POST_INSERT, decryptListener);
    service.appendListeners(EventType.POST_LOAD, decryptListener);
}
 
开发者ID:oehf,项目名称:ipf-flow-manager,代码行数:21,代码来源:CustomEventRegistration.java

示例2: integrate

import org.hibernate.service.spi.SessionFactoryServiceRegistry; //导入依赖的package包/类
public void integrate(Configuration configuration, SessionFactoryImplementor sessionFactory,
        SessionFactoryServiceRegistry serviceRegistry) {
    System.out.println("Integrating......");

    //final AuditService auditService = serviceRegistry.getService(AuditService.class);
    final AuditService auditService = new AuditServiceImpl();
    auditService.init();
    if (!auditService.isInitialized()) {
        throw new InitializationException(
                "Audit4j hibernate integration can not be initialized..");
    }

    // Register listeners..
    final EventListenerRegistry listenerRegistry = serviceRegistry
            .getService(EventListenerRegistry.class);

    listenerRegistry.appendListeners(EventType.POST_INSERT,
            new AuditPostInsertEventListenerImpl(auditService));
    listenerRegistry.appendListeners(EventType.POST_UPDATE,
            new AuditPostUpdateEventListenerImpl(auditService));
    listenerRegistry.appendListeners(EventType.POST_DELETE,
            new AuditPostDeleteEventListenerImpl(auditService));
}
 
开发者ID:nipunthathsara,项目名称:Audit4j-Hibernate,代码行数:24,代码来源:Audit4jIntegrator.java

示例3: integrate

import org.hibernate.service.spi.SessionFactoryServiceRegistry; //导入依赖的package包/类
@Override
public void integrate(
		Configuration configuration,
		SessionFactoryImplementor sessionFactory,
		SessionFactoryServiceRegistry serviceRegistry) {
	doIntegration( configuration.getProperties(), configuration.getJaccPermissionDeclarations(), serviceRegistry );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:JaccIntegrator.java

示例4: doIntegration

import org.hibernate.service.spi.SessionFactoryServiceRegistry; //导入依赖的package包/类
private void doIntegration(
		Map properties,
		JaccPermissionDeclarations permissionDeclarations,
		SessionFactoryServiceRegistry serviceRegistry) {
	boolean isSecurityEnabled = properties.containsKey( AvailableSettings.JACC_ENABLED );
	if ( ! isSecurityEnabled ) {
		log.debug( "Skipping JACC integration as it was not enabled" );
		return;
	}

	final String contextId = (String) properties.get( AvailableSettings.JACC_CONTEXT_ID );
	if ( contextId == null ) {
		throw new IntegrationException( "JACC context id must be specified" );
	}

	final JaccService jaccService = serviceRegistry.getService( JaccService.class );
	if ( jaccService == null ) {
		throw new IntegrationException( "JaccService was not set up" );
	}

	if ( permissionDeclarations != null ) {
		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() );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:35,代码来源:JaccIntegrator.java

示例5: integrate

import org.hibernate.service.spi.SessionFactoryServiceRegistry; //导入依赖的package包/类
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 );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:CollectionCacheInvalidator.java

示例6: integrate

import org.hibernate.service.spi.SessionFactoryServiceRegistry; //导入依赖的package包/类
@Override
public void integrate(Configuration configuration, SessionFactoryImplementor sessionFactory,
      SessionFactoryServiceRegistry serviceRegistry) {
   log.info("start CibetIntegrator");
   final boolean autoRegister = ConfigurationHelper.getBoolean(AUTO_REGISTER, configuration.getProperties(), true);
   if (autoRegister) {
      log.debug("Skipping Cibet Envers listener auto registration");
      return;
   }

   log.info("CibetIntegrator registers Cibet Envers listeners");

   EventListenerRegistry listenerRegistry = serviceRegistry.getService(EventListenerRegistry.class);
   listenerRegistry.addDuplicationStrategy(EnversListenerDuplicationStrategy.INSTANCE);

   enversConfiguration = AuditConfiguration.getFor(configuration,
         serviceRegistry.getService(ClassLoaderService.class));

   if (enversConfiguration.getEntCfg().hasAuditedEntities()) {
      listenerRegistry.appendListeners(EventType.POST_DELETE, new CibetPostDeleteEventListener(enversConfiguration));
      listenerRegistry.appendListeners(EventType.POST_INSERT, new CibetPostInsertEventListener(enversConfiguration));
      listenerRegistry.appendListeners(EventType.POST_UPDATE, new CibetPostUpdateEventListener(enversConfiguration));
      listenerRegistry.appendListeners(EventType.POST_COLLECTION_RECREATE,
            new CibetPostCollectionRecreateEventListener(enversConfiguration));
      listenerRegistry.appendListeners(EventType.PRE_COLLECTION_REMOVE,
            new CibetPreCollectionRemoveEventListener(enversConfiguration));
      listenerRegistry.appendListeners(EventType.PRE_COLLECTION_UPDATE,
            new CibetPreCollectionUpdateEventListener(enversConfiguration));
   }
}
 
开发者ID:Wolfgang-Winter,项目名称:cibet,代码行数:31,代码来源:CibetIntegrator.java

示例7: integrate

import org.hibernate.service.spi.SessionFactoryServiceRegistry; //导入依赖的package包/类
@Override
public void integrate( Metadata metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry )
{
    final EventListenerRegistry registry = serviceRegistry.getService( EventListenerRegistry.class );

    DeletedObjectPostDeleteEventListener listener = new DeletedObjectPostDeleteEventListener();
    registry.appendListeners( EventType.POST_DELETE, listener );
}
 
开发者ID:dhis2,项目名称:dhis2-core,代码行数:9,代码来源:DeletedObjectIntegrator.java

示例8: integrate

import org.hibernate.service.spi.SessionFactoryServiceRegistry; //导入依赖的package包/类
@Override
public void integrate(Configuration configuration,
  SessionFactoryImplementor sessionFactory,
  SessionFactoryServiceRegistry serviceRegistry) {

  // Avoid custom behavior is autoregister is true
  try {
    if (!"true".equals(ConfigUtility.getConfigProperties()
        .getProperty("hibernate.listeners.envers.autoRegister"))) {

      super.integrate(configuration, sessionFactory, serviceRegistry);

      final AuditConfiguration enversConfiguration =
          AuditConfiguration.getFor(configuration,
              serviceRegistry.getService(ClassLoaderService.class));
      EventListenerRegistry listenerRegistry =
          serviceRegistry.getService(EventListenerRegistry.class);

      listenerRegistry
          .addDuplicationStrategy(EnversListenerDuplicationStrategy.INSTANCE);

      if (enversConfiguration.getEntCfg().hasAuditedEntities()) {
        listenerRegistry.appendListeners(EventType.POST_INSERT,
            new EmptyEnversPostInsertEventListenerImpl(enversConfiguration));
        listenerRegistry.appendListeners(EventType.POST_DELETE,
            new CustomEnversPostDeleteEventListenerImpl(enversConfiguration));
      }
    }
  } catch (Exception e) {
    throw new RuntimeException(e);
  }

}
 
开发者ID:WestCoastInformatics,项目名称:UMLS-Terminology-Server,代码行数:34,代码来源:TermServerEnversIntegrator.java

示例9: integrate

import org.hibernate.service.spi.SessionFactoryServiceRegistry; //导入依赖的package包/类
@Override
public void integrate(
        Metadata metadata,
        SessionFactoryImplementor sessionFactory,
        SessionFactoryServiceRegistry serviceRegistry) {

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

    eventListenerRegistry.appendListeners(EventType.PERSIST, RootAwareInsertEventListener.INSTANCE);
    eventListenerRegistry.appendListeners(EventType.FLUSH_ENTITY, RootAwareUpdateAndDeleteEventListener.INSTANCE);
}
 
开发者ID:vladmihalcea,项目名称:high-performance-java-persistence,代码行数:13,代码来源:OptimisticLockingChildUpdatesRootVersionTest.java

示例10: integrate

import org.hibernate.service.spi.SessionFactoryServiceRegistry; //导入依赖的package包/类
@Override
public void integrate(
        Metadata metadata,
        SessionFactoryImplementor sessionFactory,
        SessionFactoryServiceRegistry serviceRegistry) {

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

    eventListenerRegistry.appendListeners( EventType.PERSIST, RootAwareInsertEventListener.INSTANCE);
    eventListenerRegistry.appendListeners( EventType.FLUSH_ENTITY, RootAwareUpdateAndDeleteEventListener.INSTANCE);
}
 
开发者ID:vladmihalcea,项目名称:high-performance-java-persistence,代码行数:13,代码来源:OptimisticLockingBidirectionalChildUpdatesRootVersionTest.java

示例11: integrate

import org.hibernate.service.spi.SessionFactoryServiceRegistry; //导入依赖的package包/类
@Override
public void integrate(
		Metadata metadata,
		SessionFactoryImplementor sessionFactory,
		SessionFactoryServiceRegistry serviceRegistry) {

	this.database = metadata.getDatabase();
	this.metadata = metadata;

}
 
开发者ID:vladmihalcea,项目名称:high-performance-java-persistence,代码行数:11,代码来源:MetadataExtractorIntegrator.java

示例12: integrate

import org.hibernate.service.spi.SessionFactoryServiceRegistry; //导入依赖的package包/类
/**
 * Appends the {@link LifecyclePostLoadEventListener}.
 * <p>
 * {@inheritDoc}
 */
@Override
public void integrate(Configuration configuration,
    SessionFactoryImplementor sessionFactory,
    SessionFactoryServiceRegistry serviceRegistry) {
  serviceRegistry.getService(EventListenerRegistry.class)
      .getEventListenerGroup(EventType.POST_LOAD)
      .appendListener(postLoadListener);
}
 
开发者ID:jspresso,项目名称:jspresso-ce,代码行数:14,代码来源:JspressoHibernateIntegrator.java

示例13: disintegrate

import org.hibernate.service.spi.SessionFactoryServiceRegistry; //导入依赖的package包/类
/**
 * Do nothing.
 * <p>
 * {@inheritDoc}
 */
@Override
public void disintegrate(SessionFactoryImplementor sessionFactory,
    SessionFactoryServiceRegistry serviceRegistry) {
  // Cannot un-register listener
  // serviceRegistry.getService(EventListenerRegistry.class)
  // .getEventListenerGroup(EventType.POST_LOAD)
  // .removeListener(postLoadListener);
}
 
开发者ID:jspresso,项目名称:jspresso-ce,代码行数:14,代码来源:JspressoHibernateIntegrator.java

示例14: integrate

import org.hibernate.service.spi.SessionFactoryServiceRegistry; //导入依赖的package包/类
public void integrate(
        Configuration configuration,
        SessionFactoryImplementor sessionFactory,
        SessionFactoryServiceRegistry serviceRegistry) {

	ConfigConventions configConventions = ConfigConventions.create(configuration);
	configConventions.validate();

	MappingConventions mappingConventions = MappingConventions.create(configuration);
	mappingConventions.normalize();
	mappingConventions.validate();

}
 
开发者ID:andreluiznsilva,项目名称:hibernate-conventions,代码行数:14,代码来源:ConventionsIntegrator.java

示例15: integrate

import org.hibernate.service.spi.SessionFactoryServiceRegistry; //导入依赖的package包/类
public void integrate(Configuration configuration, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
    
	try {
		ConfigurationHelper.setCurrentSessionFactory(sessionFactory);
	
		String isEnabled = configuration.getProperty(REGISTER_USERTYPES_KEY); 
		String javaZone = configuration.getProperty(DEFAULT_JAVAZONE_KEY);
		String databaseZone = configuration.getProperty(DEFAULT_DATABASEZONE_KEY);
		String seed = configuration.getProperty(DEFAULT_SEED_KEY);
		String currencyCode = configuration.getProperty(DEFAULT_CURRENCYCODE_KEY);
		
		String jdbc42Apis = configuration.getProperty(JDBC42_API_KEY);
		
		configureDefaultProperties(sessionFactory, javaZone, databaseZone, seed, currencyCode, jdbc42Apis);
	
		if (isEnabled != null && Boolean.valueOf(isEnabled)) {
			autoRegisterUsertypes(configuration);
		}
		
		final boolean use42Api = use42Api(configuration.getProperty(JDBC42_API_KEY), sessionFactory);
		ConfigurationHelper.setUse42Api(sessionFactory, use42Api);
		
		// doIntegrate(configuration, sessionFactory, serviceRegistry);
	} finally {
		ConfigurationHelper.setCurrentSessionFactory(null);
	}
}
 
开发者ID:JadiraOrg,项目名称:jadira,代码行数:28,代码来源:AbstractUserTypeHibernateIntegrator.java


注:本文中的org.hibernate.service.spi.SessionFactoryServiceRegistry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。