List of usage examples for org.hibernate.cfg AvailableSettings MULTI_TENANT_CONNECTION_PROVIDER
String MULTI_TENANT_CONNECTION_PROVIDER
To view the source code for org.hibernate.cfg AvailableSettings MULTI_TENANT_CONNECTION_PROVIDER.
Click Source Link
From source file:com.baomidou.hibernateplus.HibernateSpringSessionFactoryBuilder.java
License:Apache License
/** * Set a {@link MultiTenantConnectionProvider} to be passed on to the SessionFactory. * * @see AvailableSettings#MULTI_TENANT_CONNECTION_PROVIDER * @since 4.3/*from w w w . j a va2s. c om*/ */ public HibernateSpringSessionFactoryBuilder setMultiTenantConnectionProvider( MultiTenantConnectionProvider multiTenantConnectionProvider) { getProperties().put(AvailableSettings.MULTI_TENANT_CONNECTION_PROVIDER, multiTenantConnectionProvider); return this; }
From source file:com.github.javarch.persistence.orm.hibernate.conf.HibernatePropertiesConfig.java
License:Apache License
/** * Retorna um objeto Properties com todas as configuraes de propriedades que devem * ser passadas ao {@link SessionFactory}. As propriedades so definidas no arquivo * hibernate.properties que deve estar presente no raiz do classpath. * //from w w w . j a va2 s. co m * @return Properties do Hibernate. */ @Bean public Properties hibernateProperties() { Properties props = new Properties(); props.put(AvailableSettings.DIALECT, env.getRequiredProperty(AvailableSettings.DIALECT)); if (env.acceptsProfiles(Profiles.TEST)) { props.put(AvailableSettings.HBM2DDL_AUTO, env.getProperty(AvailableSettings.HBM2DDL_AUTO, "update")); } if (env.acceptsProfiles(Profiles.MULT_TENANT)) { if (log.isDebugEnabled()) { log.debug("Profile Multi Tenancy ativado! Realizando configurao..."); } if (currentIdentifierResolver == null || env.acceptsProfiles(Profiles.PRODUCTION)) { throw new DatabaseConfigurationException( "No foi encontrado nenhum objeto CurrentIdentifierResolver."); } props.put(AvailableSettings.MULTI_TENANT_IDENTIFIER_RESOLVER, currentIdentifierResolver); props.put(AvailableSettings.DATASOURCE, env.getRequiredProperty(AvailableSettings.DATASOURCE)); props.put(AvailableSettings.MULTI_TENANT_CONNECTION_PROVIDER, multiTenantConnectionProvider); props.put(AvailableSettings.MULTI_TENANT, env.getRequiredProperty(AvailableSettings.MULTI_TENANT)); } else { props.put(AvailableSettings.USE_SECOND_LEVEL_CACHE, true); props.put(AvailableSettings.USE_QUERY_CACHE, true); props.put(AvailableSettings.CACHE_REGION_FACTORY, "org.hibernate.cache.ehcache.EhCacheRegionFactory"); } if (env.acceptsProfiles(Profiles.ENVERS)) { props.put("org.hibernate.envers.versionsTableSuffix", "_audit"); props.put("org.hibernate.envers.revisionFieldName", "revision"); props.put("org.hibernate.envers.default_schema", "audit"); } return props; }
From source file:org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.java
License:Apache License
/** * Set a Hibernate 4.1/4.2/4.3 {@code MultiTenantConnectionProvider} to be passed * on to the SessionFactory: as an instance, a Class, or a String class name. * <p>Note that the package location of the {@code MultiTenantConnectionProvider} * interface changed between Hibernate 4.2 and 4.3. This method accepts both variants. * @since 4.0// ww w . j av a 2 s . c o m * @see AvailableSettings#MULTI_TENANT_CONNECTION_PROVIDER */ public LocalSessionFactoryBuilder setMultiTenantConnectionProvider(Object multiTenantConnectionProvider) { getProperties().put(AvailableSettings.MULTI_TENANT_CONNECTION_PROVIDER, multiTenantConnectionProvider); return this; }