本文整理了Java中org.hibernate.cfg.Settings
类的一些代码示例,展示了Settings
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Settings
类的具体详情如下:
包路径:org.hibernate.cfg.Settings
类名称:Settings
[英]Settings that affect the behaviour of Hibernate at runtime.
[中]影响Hibernate在运行时行为的设置。
代码示例来源:origin: redisson/redisson
@Override
public boolean putFromLoad(SessionImplementor session, Object key, Object value, long txTimestamp, Object version) throws CacheException {
return putFromLoad(session, key, value, txTimestamp, version, settings.isMinimalPutsEnabled() );
}
代码示例来源:origin: hibernate/hibernate-orm
this.settings = new Settings( options, metadata );
String sfName = settings.getSessionFactoryName();
if ( cfgXmlAccessService.getAggregatedConfig() != null ) {
if ( sfName == null ) {
metadata.getEntityBindings().stream().filter( model -> !model.isInherited() ).forEach( model -> {
IdentifierGenerator generator = model.getIdentifier().createIdentifierGenerator(
metadata.getIdentifierGeneratorFactory(),
jdbcServices.getJdbcEnvironment().getDialect(),
settings.getDefaultCatalogName(),
settings.getDefaultSchemaName(),
(RootClass) model
);
identifierGenerators.put( model.getEntityName(), generator );
} );
settings.getMultiTableBulkIdStrategy().prepare(
jdbcServices,
buildLocalConnectionAccess(),
if ( settings.isNamedQueryStartupCheckingEnabled() ) {
final Map<String, HibernateException> errors = checkNamedQueries();
if ( !errors.isEmpty() ) {
getUuid(),
name,
settings.isSessionFactoryNameAlsoJndiName(),
this,
代码示例来源:origin: hibernate/hibernate-orm
/**
* Mainly for subclass usage. This impl always returns after_transaction.
*
* @return The connection release mode for any built sessions.
*/
protected ConnectionReleaseMode getConnectionReleaseMode() {
return factory().getSettings().getConnectionReleaseMode();
}
代码示例来源:origin: hibernate/hibernate-orm
public Map<String, String> getAliasTableMap(SessionFactoryImplementor factory) {
Map<String, String> mergedAliasTableMap = mergeAliasMaps( factory );
if ( !mergedAliasTableMap.isEmpty() ) {
return mergedAliasTableMap;
}
else if ( persistentClass != null ) {
String table = persistentClass.getTable().getQualifiedName(
factory.getDialect(),
factory.getSettings().getDefaultCatalogName(),
factory.getSettings().getDefaultSchemaName()
);
return Collections.singletonMap( null, table );
}
else {
return Collections.emptyMap();
}
}
代码示例来源:origin: hibernate/hibernate-orm
final String catalogName = factory.getSettings().getDefaultCatalogName();
if ( catalogName != null ) {
result.append( catalogName );
result.append( "." );
final String schemaName = factory.getSettings().getDefaultSchemaName();
if ( schemaName != null ) {
result.append( schemaName );
final String schemaName = factory.getSettings().getDefaultSchemaName();
if ( schemaName != null ) {
result.append(schemaName);
final String catalogName = factory.getSettings().getDefaultCatalogName();
if ( catalogName != null ) {
result.append( catalogName );
代码示例来源:origin: hibernate/hibernate-orm
protected String generateSubquery(PersistentClass model, Mapping mapping) {
Dialect dialect = getFactory().getDialect();
Settings settings = getFactory().getSettings();
if ( !model.hasSubclasses() ) {
return model.getTable().getQualifiedName(
dialect,
settings.getDefaultCatalogName(),
settings.getDefaultSchemaName()
);
Iterator titer = model.getSubclassTableClosureIterator();
while ( titer.hasNext() ) {
Table table = (Table) titer.next();
table.getQualifiedName(
dialect,
settings.getDefaultCatalogName(),
settings.getDefaultSchemaName()
代码示例来源:origin: hibernate/hibernate-orm
explicitDiscriminatorColumnName = column.getQuotedName( factory.getDialect() );
discriminatorAlias = column.getAlias( factory.getDialect(), persistentClass.getRootTable() );
discriminatorSQLString = discriminatorType.objectToSQLString( discriminatorValue, factory.getDialect() );
factory.getSettings().getDefaultCatalogName(),
factory.getSettings().getDefaultSchemaName()
);
propertyTableNumbers[i] = getTableId( tabname, this.tableNames );
factory.getSettings().getDefaultCatalogName(),
factory.getSettings().getDefaultSchemaName()
);
Integer tabnum = getTableId( tabname, subclassTableNameClosure );
factory.getSettings().getDefaultCatalogName(),
factory.getSettings().getDefaultSchemaName()
),
subclassTableNameClosure
factory.getSettings().getDefaultCatalogName(),
factory.getSettings().getDefaultSchemaName()
),
subclassTableNameClosure
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate
tableName = persistentClass.getTable().getQualifiedName(
factory.getDialect(),
factory.getSettings().getDefaultCatalogName(),
factory.getSettings().getDefaultSchemaName()
);
boolean callable = false;
ExecuteUpdateResultCheckStyle checkStyle = null;
sql = persistentClass.getCustomSQLInsert();
callable = sql != null && persistentClass.isCustomInsertCallable();
checkStyle = sql == null
? ExecuteUpdateResultCheckStyle.COUNT
subclassTables.add( table.getQualifiedName(
factory.getDialect(),
factory.getSettings().getDefaultCatalogName(),
factory.getSettings().getDefaultSchemaName()
) );
String tableName = tab.getQualifiedName(
factory.getDialect(),
factory.getSettings().getDefaultCatalogName(),
factory.getSettings().getDefaultSchemaName()
);
tableNames.add( tableName );
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate
settings.getRegionFactory().start( settings, properties );
this.queryPlanCache = new QueryPlanCache( this );
while ( classes.hasNext() ) {
PersistentClass model = (PersistentClass) classes.next();
if ( !model.isInherited() ) {
IdentifierGenerator generator = model.getIdentifier().createIdentifierGenerator(
cfg.getIdentifierGeneratorFactory(),
getDialect(),
settings.getDefaultCatalogName(),
settings.getDefaultSchemaName(),
(RootClass) model
);
identifierGenerators.put( model.getEntityName(), generator );
final String cacheRegionPrefix = settings.getCacheRegionPrefix() == null ? "" : settings.getCacheRegionPrefix() + ".";
if ( accessStrategy == null && settings.isSecondLevelCacheEnabled() ) {
EntityRegion entityRegion = settings.getRegionFactory().buildEntityRegion( cacheRegionName, properties, CacheDataDescriptionImpl.decode( model ) );
accessStrategy = entityRegion.buildAccessStrategy( accessType );
entityAccessStrategies.put( cacheRegionName, accessStrategy );
if ( naturalIdAccessStrategy == null && settings.isSecondLevelCacheEnabled() ) {
final NaturalIdRegion naturalIdRegion = settings.getRegionFactory().buildNaturalIdRegion( naturalIdCacheRegionName, properties, CacheDataDescriptionImpl.decode( model ) );
naturalIdAccessStrategy = naturalIdRegion.buildAccessStrategy( settings.getRegionFactory().getDefaultAccessType() );
entityAccessStrategies.put( naturalIdCacheRegionName, naturalIdAccessStrategy );
allCacheRegions.put( naturalIdCacheRegionName, naturalIdRegion );
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
public Settings buildSettings(Properties props, ServiceRegistry serviceRegistry) {
final boolean debugEnabled = LOG.isDebugEnabled();
final JdbcServices jdbcServices = serviceRegistry.getService( JdbcServices.class );
Settings settings = new Settings();
settings.setSessionFactoryName( sessionFactoryName );
settings.setSessionFactoryNameAlsoJndiName(
ConfigurationHelper.getBoolean( AvailableSettings.SESSION_FACTORY_NAME_IS_JNDI, props, true )
);
settings.setDataDefinitionImplicitCommit( meta.doesDataDefinitionCauseTransactionCommit() );
settings.setDataDefinitionInTransactionSupported( meta.supportsDataDefinitionInTransaction() );
settings.setJtaPlatform( serviceRegistry.getService( JtaPlatform.class ) );
settings.setFlushBeforeCompletionEnabled(flushBeforeCompletion);
settings.setAutoCloseSessionEnabled(autoCloseSession);
settings.setJdbcBatchSize(batchSize);
settings.setJdbcBatchVersionedData(jdbcBatchVersionedData);
settings.setScrollableResultSetsEnabled(useScrollableResultSets);
settings.setWrapResultSetsEnabled(wrapResultSets);
settings.setGetGeneratedKeysEnabled(useGetGeneratedKeys);
settings.setJdbcFetchSize(statementFetchSize);
代码示例来源:origin: hibernate/hibernate
settings.getCacheProvider().start( properties );
while ( classes.hasNext() ) {
PersistentClass model = (PersistentClass) classes.next();
if ( !model.isInherited() ) {
IdentifierGenerator generator = model.getIdentifier().createIdentifierGenerator(
settings.getDialect(),
settings.getDefaultCatalogName(),
settings.getDefaultSchemaName(),
(RootClass) model
);
identifierGenerators.put( model.getEntityName(), generator );
name = settings.getSessionFactoryName();
try {
uuid = (String) UUID_GENERATOR.generate(null, null);
if ( settings.isAutoCreateSchema() ) new SchemaExport(cfg).create(false, true);
if ( settings.isAutoUpdateSchema() ) new SchemaUpdate(cfg).execute(false, true);
if ( settings.isAutoDropSchema() ) schemaExport = new SchemaExport(cfg);
if ( settings.getTransactionManagerLookup()!=null ) {
log.debug("obtaining JTA TransactionManager");
transactionManager = settings.getTransactionManagerLookup().getTransactionManager(properties);
if ( settings.isQueryCacheEnabled() ) {
updateTimestampsCache = new UpdateTimestampsCache(settings, properties);
queryCache = settings.getQueryCacheFactory()
.getQueryCache(null, updateTimestampsCache, settings, properties);
代码示例来源:origin: hibernate/hibernate
public Settings buildSettings(Properties props) {
Settings settings = new Settings();
settings.setSessionFactoryName(sessionFactoryName);
settings.setConnectionProvider(connections);
settings.setDialect(dialect);
settings.setTransactionFactory(transactionFactory);
settings.setTransactionManagerLookup( createTransactionManagerLookup(properties) );
settings.setFlushBeforeCompletionEnabled(flushBeforeCompletion);
settings.setAutoCloseSessionEnabled(autoCloseSession);
if ( !metaSupportsBatchUpdates ) batchSize = 0;
if (batchSize>0) log.info("JDBC batch size: " + batchSize);
settings.setJdbcBatchSize(batchSize);
boolean jdbcBatchVersionedData = PropertiesHelper.getBoolean(Environment.BATCH_VERSIONED_DATA, properties, false);
if (batchSize>0) log.info("JDBC batch updates for versioned data: " + enabledDisabled(jdbcBatchVersionedData) );
settings.setJdbcBatchVersionedData(jdbcBatchVersionedData);
settings.setBatcherFactory( createBatcherFactory(properties, batchSize) );
settings.setScrollableResultSetsEnabled(useScrollableResultSets);
settings.setWrapResultSetsEnabled(wrapResultSets);
settings.setGetGeneratedKeysEnabled(useGetGeneratedKeys);
代码示例来源:origin: hibernate/hibernate
String tabname = tab.getQualifiedName(
factory.getDialect(),
factory.getSettings().getDefaultCatalogName(),
factory.getSettings().getDefaultSchemaName()
);
tables.add(tabname);
String tabname = tab.getQualifiedName(
factory.getDialect(),
factory.getSettings().getDefaultCatalogName(),
factory.getSettings().getDefaultSchemaName()
);
subtables.add(tabname);
String tabname = prop.getValue().getTable().getQualifiedName(
factory.getDialect(),
factory.getSettings().getDefaultCatalogName(),
factory.getSettings().getDefaultSchemaName()
);
propertyTableNumbers[i] = getTableId(tabname, tableNames);
String tabname = tab.getQualifiedName(
factory.getDialect(),
factory.getSettings().getDefaultCatalogName(),
factory.getSettings().getDefaultSchemaName()
);
Integer tabnum = new Integer( getTableId(tabname, subclassTableNameClosure) );
factory.getSettings().getDefaultCatalogName(),
代码示例来源:origin: hibernate/hibernate
tableName = persistentClass.getTable().getQualifiedName(
factory.getDialect(),
factory.getSettings().getDefaultCatalogName(),
factory.getSettings().getDefaultSchemaName()
);
insertCallable = new boolean[] { persistentClass.isCustomInsertCallable() };
updateCallable = new boolean[] { persistentClass.isCustomUpdateCallable() };
deleteCallable = new boolean[] { persistentClass.isCustomDeleteCallable() };
subclassTables.add( table.getQualifiedName(
factory.getDialect(),
factory.getSettings().getDefaultCatalogName(),
factory.getSettings().getDefaultSchemaName()
) );
代码示例来源:origin: hibernate/hibernate-orm
if ( factory.getSessionFactoryOptions().isStructuredCacheEntriesEnabled() ) {
cacheEntryStructure = collectionBinding.isMap()
? StructuredMapCacheEntry.INSTANCE
dialect = factory.getDialect();
sqlExceptionHelper = factory.getSQLExceptionHelper();
collectionType = collectionBinding.getCollectionType();
navigableRole = new NavigableRole( collectionBinding.getRole() );
creationContext.getMetadata().getIdentifierGeneratorFactory(),
factory.getDialect(),
factory.getSettings().getDefaultCatalogName(),
factory.getSettings().getDefaultSchemaName(),
null
);
代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all
tableName = persistentClass.getTable().getQualifiedName(
factory.getDialect(),
factory.getSettings().getDefaultCatalogName(),
factory.getSettings().getDefaultSchemaName()
);
boolean callable = false;
ExecuteUpdateResultCheckStyle checkStyle = null;
sql = persistentClass.getCustomSQLInsert();
callable = sql != null && persistentClass.isCustomInsertCallable();
checkStyle = sql == null
? ExecuteUpdateResultCheckStyle.COUNT
代码示例来源:origin: hibernate/hibernate
Settings settings = getFactory().getSettings();
if ( !model.hasSubclasses() ) {
return model.getTable().getQualifiedName(
dialect,
settings.getDefaultCatalogName(),
settings.getDefaultSchemaName()
);
Iterator titer = model.getSubclassTableClosureIterator();
while ( titer.hasNext() ) {
Table table = (Table) titer.next();
.append( table.getQualifiedName(
dialect,
settings.getDefaultCatalogName(),
settings.getDefaultSchemaName()
) );
buf.append(" union ");
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate
settings.getRegionFactory().start( settings, properties );
this.queryPlanCache = new QueryPlanCache( this );
if ( settings.getCacheRegionPrefix() != null) {
stringBuilder
.append( settings.getCacheRegionPrefix() )
.append( '.' );
if ( settings.isSecondLevelCacheEnabled() &&
rootEntityBinding.getHierarchyDetails().getCaching() != null &&
model.getHierarchyDetails().getCaching() != null &&
EntityRegion entityRegion = settings.getRegionFactory().buildEntityRegion(
cacheRegionName, properties, CacheDataDescriptionImpl.decode( model )
);
final AccessType accessType = model.getCaching().getAccessType();
CollectionRegionAccessStrategy accessStrategy = null;
if ( accessType != null && settings.isSecondLevelCacheEnabled() ) {
if ( LOG.isTraceEnabled() ) {
LOG.tracev( "Building cache for collection data [{0}]", model.getAttribute().getRole() );
CollectionRegion collectionRegion = settings.getRegionFactory().buildCollectionRegion(
cacheRegionName, properties, CacheDataDescriptionImpl.decode( model )
);
name = settings.getSessionFactoryName();
try {
uuid = (String) UUID_GENERATOR.generate(null, null);
代码示例来源:origin: hibernate/hibernate-orm
private boolean isOuterJoinFetchingDisabled() {
return new Integer(0).equals( sessionFactory().getSettings().getMaximumFetchDepth() );
}
代码示例来源:origin: hibernate/hibernate-orm
);
if ( source.getFactory().getSettings().isIdentifierRollbackEnabled() ) {
persister.resetIdentifier( entity, id, version, source );
内容来源于网络,如有侵权,请联系作者删除!