本文整理汇总了Java中org.hibernate.internal.util.config.ConfigurationHelper.getBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationHelper.getBoolean方法的具体用法?Java ConfigurationHelper.getBoolean怎么用?Java ConfigurationHelper.getBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.internal.util.config.ConfigurationHelper
的用法示例。
在下文中一共展示了ConfigurationHelper.getBoolean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyRelationalConstraints
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
@SuppressWarnings({"unchecked", "UnusedParameters"})
private static void applyRelationalConstraints(ValidatorFactory factory, ActivationContext activationContext) {
final Properties properties = activationContext.getConfiguration().getProperties();
if ( ! ConfigurationHelper.getBoolean( BeanValidationIntegrator.APPLY_CONSTRAINTS, properties, true ) ){
LOG.debug( "Skipping application of relational constraints from legacy Hibernate Validator" );
return;
}
final Set<ValidationMode> modes = activationContext.getValidationModes();
if ( ! ( modes.contains( ValidationMode.DDL ) || modes.contains( ValidationMode.AUTO ) ) ) {
return;
}
applyRelationalConstraints(
factory,
activationContext.getConfiguration().createMappings().getClasses().values(),
properties,
activationContext.getServiceRegistry().getService( JdbcServices.class ).getDialect()
);
}
示例2: determineSequenceName
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
/**
* Determine the name of the sequence (or table if this resolves to a physical table)
* to use.
* <p/>
* Called during {@link #configure configuration}.
*
* @param params The params supplied in the generator config (plus some standard useful extras).
* @param dialect The dialect in effect
* @return The sequence name
*/
protected String determineSequenceName(Properties params, Dialect dialect) {
final String sequencePerEntitySuffix = ConfigurationHelper.getString( CONFIG_SEQUENCE_PER_ENTITY_SUFFIX, params, DEF_SEQUENCE_SUFFIX );
// JPA_ENTITY_NAME value honors <class ... entity-name="..."> (HBM) and @Entity#name (JPA) overrides.
String sequenceName = ConfigurationHelper.getBoolean( CONFIG_PREFER_SEQUENCE_PER_ENTITY, params, false )
? params.getProperty( JPA_ENTITY_NAME ) + sequencePerEntitySuffix
: DEF_SEQUENCE_NAME;
final ObjectNameNormalizer normalizer = (ObjectNameNormalizer) params.get( IDENTIFIER_NORMALIZER );
sequenceName = ConfigurationHelper.getString( SEQUENCE_PARAM, params, sequenceName );
if ( sequenceName.indexOf( '.' ) < 0 ) {
sequenceName = normalizer.normalizeIdentifierQuoting( sequenceName );
final String schemaName = params.getProperty( SCHEMA );
final String catalogName = params.getProperty( CATALOG );
sequenceName = Table.qualify(
dialect.quote( catalogName ),
dialect.quote( schemaName ),
dialect.quote( sequenceName )
);
}
// if already qualified there is not much we can do in a portable manner so we pass it
// through and assume the user has set up the name correctly.
return sequenceName;
}
示例3: DatabaseMetadata
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
public DatabaseMetadata(Connection connection, Dialect dialect, Configuration config, boolean extras)
throws SQLException {
sqlExceptionConverter = dialect.buildSQLExceptionConverter();
meta = connection.getMetaData();
this.extras = extras;
initSequences( connection, dialect );
if ( config != null
&& ConfigurationHelper.getBoolean( AvailableSettings.ENABLE_SYNONYMS, config.getProperties(), false ) ) {
types = new String[] { "TABLE", "VIEW", "SYNONYM" };
}
else {
types = new String[] { "TABLE", "VIEW" };
}
}
示例4: JmxServiceImpl
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
public JmxServiceImpl(Map configValues) {
usePlatformServer = ConfigurationHelper.getBoolean( AvailableSettings.JMX_PLATFORM_SERVER, configValues );
agentId = (String) configValues.get( AvailableSettings.JMX_AGENT_ID );
defaultDomain = (String) configValues.get( AvailableSettings.JMX_DOMAIN_NAME );
sessionFactoryName = ConfigurationHelper.getString(
AvailableSettings.JMX_SF_NAME,
configValues,
ConfigurationHelper.getString( Environment.SESSION_FACTORY_NAME, configValues )
);
}
示例5: configure
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
public void configure(Map configValues) {
cacheTransactionManager = ConfigurationHelper.getBoolean(
AvailableSettings.JTA_CACHE_TM,
configValues,
canCacheTransactionManagerByDefault()
);
cacheUserTransaction = ConfigurationHelper.getBoolean(
AvailableSettings.JTA_CACHE_UT,
configValues,
canCacheUserTransactionByDefault()
);
}
示例6: buildCreator
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
private ConnectionCreator buildCreator(Map configurationValues) {
final ConnectionCreatorBuilder connectionCreatorBuilder = new ConnectionCreatorBuilder( serviceRegistry );
final String driverClassName = (String) configurationValues.get( AvailableSettings.DRIVER );
connectionCreatorBuilder.setDriver( loadDriverIfPossible( driverClassName ) );
final String url = (String) configurationValues.get( AvailableSettings.URL );
if ( url == null ) {
final String msg = log.jdbcUrlNotSpecified( AvailableSettings.URL );
log.error( msg );
throw new HibernateException( msg );
}
connectionCreatorBuilder.setUrl( url );
log.usingDriver( driverClassName, url );
final Properties connectionProps = ConnectionProviderInitiator.getConnectionProperties( configurationValues );
// if debug level is enabled, then log the password, otherwise mask it
if ( log.isDebugEnabled() ) {
log.connectionProperties( connectionProps );
}
else {
log.connectionProperties( ConfigurationHelper.maskOut( connectionProps, "password" ) );
}
connectionCreatorBuilder.setConnectionProps( connectionProps );
final boolean autoCommit = ConfigurationHelper.getBoolean( AvailableSettings.AUTOCOMMIT, configurationValues, false );
log.autoCommitMode( autoCommit );
connectionCreatorBuilder.setAutoCommit( autoCommit );
final Integer isolation = ConfigurationHelper.getInteger( AvailableSettings.ISOLATION, configurationValues );
if ( isolation != null ) {
log.jdbcIsolationLevel( Environment.isolationLevelToString( isolation ) );
}
connectionCreatorBuilder.setIsolation( isolation );
return connectionCreatorBuilder.build();
}
示例7: AbstractServiceRegistryImpl
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
protected AbstractServiceRegistryImpl(
ServiceRegistryImplementor parent,
boolean autoCloseRegistry) {
this.parent = parent;
this.allowCrawling = ConfigurationHelper.getBoolean( ALLOW_CRAWLING, Environment.getProperties(), true );
this.autoCloseRegistry = autoCloseRegistry;
this.parent.registerChild( this );
}
示例8: configure
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
@Override
public void configure(Type type, Properties params, Dialect dialect) throws MappingException {
this.identifierType = type;
boolean forceTableUse = ConfigurationHelper.getBoolean( FORCE_TBL_PARAM, params, false );
final String sequenceName = determineSequenceName( params, dialect );
final int initialValue = determineInitialValue( params );
int incrementSize = determineIncrementSize( params );
final String optimizationStrategy = determineOptimizationStrategy( params, incrementSize );
incrementSize = determineAdjustedIncrementSize( optimizationStrategy, incrementSize );
if ( dialect.supportsSequences() && !forceTableUse ) {
if ( !dialect.supportsPooledSequences() && OptimizerFactory.isPooledOptimizer( optimizationStrategy ) ) {
forceTableUse = true;
LOG.forcingTableUse();
}
}
this.databaseStructure = buildDatabaseStructure(
type,
params,
dialect,
forceTableUse,
sequenceName,
initialValue,
incrementSize
);
this.optimizer = OptimizerFactory.buildOptimizer(
optimizationStrategy,
identifierType.getReturnedClass(),
incrementSize,
ConfigurationHelper.getInt( INITIAL_PARAM, params, -1 )
);
this.databaseStructure.prepare( optimizer );
}
示例9: determineOptimizationStrategy
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
/**
* Determine the optimizer to use.
* <p/>
* Called during {@link #configure configuration}.
*
* @param params The params supplied in the generator config (plus some standard useful extras).
* @param incrementSize The {@link #determineIncrementSize determined increment size}
* @return The optimizer strategy (name)
*/
protected String determineOptimizationStrategy(Properties params, int incrementSize) {
// if the increment size is greater than one, we prefer pooled optimization; but we first
// need to see if the user prefers POOL or POOL_LO...
final String defaultPooledOptimizerStrategy = ConfigurationHelper.getBoolean( Environment.PREFER_POOLED_VALUES_LO, params, false )
? StandardOptimizerDescriptor.POOLED_LO.getExternalName()
: StandardOptimizerDescriptor.POOLED.getExternalName();
final String defaultOptimizerStrategy = incrementSize <= 1
? StandardOptimizerDescriptor.NONE.getExternalName()
: defaultPooledOptimizerStrategy;
return ConfigurationHelper.getString( OPT_PARAM, params, defaultOptimizerStrategy );
}
示例10: configure
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
@Override
public void configure(Type type, Properties params, Dialect dialect) throws MappingException {
identifierType = type;
tableName = determineGeneratorTableName( params, dialect );
segmentColumnName = determineSegmentColumnName( params, dialect );
valueColumnName = determineValueColumnName( params, dialect );
segmentValue = determineSegmentValue( params );
segmentValueLength = determineSegmentColumnSize( params );
initialValue = determineInitialValue( params );
incrementSize = determineIncrementSize( params );
this.selectQuery = buildSelectQuery( dialect );
this.updateQuery = buildUpdateQuery();
this.insertQuery = buildInsertQuery();
// if the increment size is greater than one, we prefer pooled optimization; but we
// need to see if the user prefers POOL or POOL_LO...
final String defaultPooledOptimizerStrategy = ConfigurationHelper.getBoolean( Environment.PREFER_POOLED_VALUES_LO, params, false )
? StandardOptimizerDescriptor.POOLED_LO.getExternalName()
: StandardOptimizerDescriptor.POOLED.getExternalName();
final String defaultOptimizerStrategy = incrementSize <= 1
? StandardOptimizerDescriptor.NONE.getExternalName()
: defaultPooledOptimizerStrategy;
final String optimizationStrategy = ConfigurationHelper.getString( OPT_PARAM, params, defaultOptimizerStrategy );
optimizer = OptimizerFactory.buildOptimizer(
optimizationStrategy,
identifierType.getReturnedClass(),
incrementSize,
ConfigurationHelper.getInt( INITIAL_PARAM, params, -1 )
);
}
示例11: prepare
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
@Override
public void prepare(
JdbcServices jdbcServices,
JdbcConnectionAccess connectionAccess,
Mappings mappings,
Mapping mapping,
Map settings) {
this.catalog = ConfigurationHelper.getString(
CATALOG,
settings,
ConfigurationHelper.getString( AvailableSettings.DEFAULT_CATALOG, settings )
);
this.schema = ConfigurationHelper.getString(
SCHEMA,
settings,
ConfigurationHelper.getString( AvailableSettings.DEFAULT_SCHEMA, settings )
);
this.cleanUpTables = ConfigurationHelper.getBoolean( CLEAN_UP_ID_TABLES, settings, false );
final Iterator<PersistentClass> entityMappings = mappings.iterateClasses();
final List<Table> idTableDefinitions = new ArrayList<Table>();
while ( entityMappings.hasNext() ) {
final PersistentClass entityMapping = entityMappings.next();
final Table idTableDefinition = generateIdTableDefinition( entityMapping );
idTableDefinitions.add( idTableDefinition );
}
exportTableDefinitions( idTableDefinitions, jdbcServices, connectionAccess, mappings, mapping );
}
示例12: integrate
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的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));
}
}
示例13: initiateService
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
@Override
public JmxService initiateService(Map configurationValues, ServiceRegistryImplementor registry) {
return ConfigurationHelper.getBoolean( AvailableSettings.JMX_ENABLED, configurationValues, false )
? new JmxServiceImpl( configurationValues )
: DisabledJmxServiceImpl.INSTANCE;
}
示例14: setParameterValues
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
@Override
public void setParameterValues(Properties parameters) {
final ParameterType reader = (ParameterType) parameters.get( PARAMETER_TYPE );
// IMPL NOTE : be protective about not setting enumValueMapper (i.e. calling treatAsNamed/treatAsOrdinal)
// in cases where we do not have enough information. In such cases we do additional checks
// as part of nullSafeGet/nullSafeSet to query against the JDBC metadata to make the determination.
if ( reader != null ) {
enumClass = reader.getReturnedClass().asSubclass( Enum.class );
final boolean isOrdinal;
final javax.persistence.EnumType enumType = getEnumType( reader );
if ( enumType == null ) {
isOrdinal = true;
}
else if ( javax.persistence.EnumType.ORDINAL.equals( enumType ) ) {
isOrdinal = true;
}
else if ( javax.persistence.EnumType.STRING.equals( enumType ) ) {
isOrdinal = false;
}
else {
throw new AssertionFailure( "Unknown EnumType: " + enumType );
}
if ( isOrdinal ) {
treatAsOrdinal();
}
else {
treatAsNamed();
}
sqlType = enumValueMapper.getSqlType();
}
else {
String enumClassName = (String) parameters.get( ENUM );
try {
enumClass = ReflectHelper.classForName( enumClassName, this.getClass() ).asSubclass( Enum.class );
}
catch ( ClassNotFoundException exception ) {
throw new HibernateException( "Enum class not found", exception );
}
final Object useNamedSetting = parameters.get( NAMED );
if ( useNamedSetting != null ) {
final boolean useNamed = ConfigurationHelper.getBoolean( NAMED, parameters );
if ( useNamed ) {
treatAsNamed();
}
else {
treatAsOrdinal();
}
sqlType = enumValueMapper.getSqlType();
}
}
final String type = (String) parameters.get( TYPE );
if ( type != null ) {
sqlType = Integer.decode( type );
}
}
示例15: isNativeClient
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
public static boolean isNativeClient(final Properties props) {
return ConfigurationHelper.getBoolean(CacheEnvironment.USE_NATIVE_CLIENT, props, false);
}