Java Code Examples for org.hibernate.hql.spi.id.MultiTableBulkIdStrategy

The following examples show how to use org.hibernate.hql.spi.id.MultiTableBulkIdStrategy. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: lams   Source File: DB297Dialect.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() {
	// Starting in DB2 9.7, "real" global temporary tables that can be shared between sessions
	// are supported; (obviously) data is not shared between sessions.
	return new GlobalTemporaryTableBulkIdStrategy(
			new IdTableSupportStandardImpl() {
				@Override
				public String generateIdTableName(String baseName) {
					return super.generateIdTableName( baseName );
				}

				@Override
				public String getCreateIdTableCommand() {
					return "create global temporary table";
				}

				@Override
				public String getCreateIdTableStatementOptions() {
					return "not logged";
				}
			},
			AfterUseAction.CLEAN
	);
}
 
Example 2
Source Project: lams   Source File: DerbyDialect.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 * <p>
 * From Derby docs:
 * <pre>
 *     The DECLARE GLOBAL TEMPORARY TABLE statement defines a temporary table for the current connection.
 * </pre>
 *
 * {@link DB2Dialect} returns a {@link org.hibernate.hql.spi.id.global.GlobalTemporaryTableBulkIdStrategy} that
 * will make temporary tables created at startup and hence unavailable for subsequent connections.<br/>
 * see HHH-10238.
 * </p>
    */
@Override
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() {
	return new LocalTemporaryTableBulkIdStrategy(new IdTableSupportStandardImpl() {
		@Override
		public String generateIdTableName(String baseName) {
			return "session." + super.generateIdTableName( baseName );
		}

		@Override
		public String getCreateIdTableCommand() {
			return "declare global temporary table";
		}

		@Override
		public String getCreateIdTableStatementOptions() {
			return "not logged";
		}
	}, AfterUseAction.CLEAN, null);
}
 
Example 3
Source Project: lams   Source File: H2Dialect.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() {
	return new LocalTemporaryTableBulkIdStrategy(
			new IdTableSupportStandardImpl() {
				@Override
				public String getCreateIdTableCommand() {
					return "create cached local temporary table if not exists";
				}

				@Override
				public String getCreateIdTableStatementOptions() {
					// actually 2 different options are specified here:
					//		1) [on commit drop] - says to drop the table on transaction commit
					//		2) [transactional] - says to not perform an implicit commit of any current transaction
					return "on commit drop transactional";					}
			},
			AfterUseAction.CLEAN,
			TempTableDdlTransactionHandling.NONE
	);
}
 
Example 4
Source Project: lams   Source File: MySQLDialect.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() {
	return new LocalTemporaryTableBulkIdStrategy(
			new IdTableSupportStandardImpl() {
				@Override
				public String getCreateIdTableCommand() {
					return "create temporary table if not exists";
				}

				@Override
				public String getDropIdTableCommand() {
					return "drop temporary table";
				}
			},
			AfterUseAction.DROP,
			TempTableDdlTransactionHandling.NONE
	);
}
 
Example 5
Source Project: lams   Source File: Oracle8iDialect.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() {
	return new GlobalTemporaryTableBulkIdStrategy(
			new IdTableSupportStandardImpl() {
				@Override
				public String generateIdTableName(String baseName) {
					final String name = super.generateIdTableName( baseName );
					return name.length() > 30 ? name.substring( 0, 30 ) : name;
				}

				@Override
				public String getCreateIdTableCommand() {
					return "create global temporary table";
				}

				@Override
				public String getCreateIdTableStatementOptions() {
					return "on commit delete rows";
				}
			},
			AfterUseAction.CLEAN
	);
}
 
Example 6
Source Project: lams   Source File: PostgreSQL82Dialect.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() {
	return new LocalTemporaryTableBulkIdStrategy(
			new IdTableSupportStandardImpl() {
				@Override
				public String getCreateIdTableCommand() {
					return "create temporary  table";
				}

				@Override
				public String getDropIdTableCommand() {
					return "drop table";
				}
			},
			AfterUseAction.DROP,
			null
	);
}
 
Example 7
Source Project: lams   Source File: SAPDBDialect.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() {
	return new LocalTemporaryTableBulkIdStrategy(
			new IdTableSupportStandardImpl() {
				@Override
				public String generateIdTableName(String baseName) {
					return "temp." + super.generateIdTableName( baseName );
				}

				@Override
				public String getCreateIdTableStatementOptions() {
					return "ignore rollback";
				}
			},
			AfterUseAction.DROP,
			null
	);
}
 
Example 8
Source Project: lams   Source File: InformixDialect.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() {
	return new LocalTemporaryTableBulkIdStrategy(
			new IdTableSupportStandardImpl() {
				@Override
				public String getCreateIdTableCommand() {
					return "create temp table";
				}

				@Override
				public String getCreateIdTableStatementOptions() {
					return "with no log";
				}
			},
			AfterUseAction.CLEAN,
			null
	);
}
 
Example 9
Source Project: lams   Source File: Oracle9Dialect.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() {
	return new GlobalTemporaryTableBulkIdStrategy(
			new IdTableSupportStandardImpl() {
				@Override
				public String generateIdTableName(String baseName) {
					final String name = super.generateIdTableName( baseName );
					return name.length() > 30 ? name.substring( 0, 30 ) : name;
				}

				@Override
				public String getCreateIdTableCommand() {
					return "create global temporary table";
				}

				@Override
				public String getCreateIdTableStatementOptions() {
					return "on commit delete rows";
				}
			},
			AfterUseAction.CLEAN
	);
}
 
Example 10
Source Project: lams   Source File: IngresDialect.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() {
	return new GlobalTemporaryTableBulkIdStrategy(
			new IdTableSupportStandardImpl() {
				@Override
				public String generateIdTableName(String baseName) {
					return "session." + super.generateIdTableName( baseName );
				}

				@Override
				public String getCreateIdTableCommand() {
					return "declare global temporary table";
				}

				@Override
				public String getCreateIdTableStatementOptions() {
					return "on commit preserve rows with norecovery";
				}
			},
			AfterUseAction.CLEAN
	);
}
 
Example 11
Source Project: lams   Source File: DB2Dialect.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() {
	// Prior to DB2 9.7, "real" global temporary tables that can be shared between sessions
	// are *not* supported; even though the DB2 command says to declare a "global" temp table
	// Hibernate treats it as a "local" temp table.
	return new LocalTemporaryTableBulkIdStrategy(
			new IdTableSupportStandardImpl() {
				@Override
				public String generateIdTableName(String baseName) {
					return "session." + super.generateIdTableName( baseName );
				}

				@Override
				public String getCreateIdTableCommand() {
					return "declare global temporary table";
				}

				@Override
				public String getCreateIdTableStatementOptions() {
					return "not logged";
				}
			},
			AfterUseAction.DROP,
			null
	);
}
 
Example 12
Source Project: lams   Source File: Cache71Dialect.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() {
	return new GlobalTemporaryTableBulkIdStrategy(
			new IdTableSupportStandardImpl() {
				@Override
				public String generateIdTableName(String baseName) {
					final String name = super.generateIdTableName( baseName );
					return name.length() > 25 ? name.substring( 1, 25 ) : name;
				}

				@Override
				public String getCreateIdTableCommand() {
					return "create global temporary table";
				}
			},
			AfterUseAction.DROP
	);
}
 
Example 13
Source Project: lams   Source File: TimesTenDialect.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() {
	return new GlobalTemporaryTableBulkIdStrategy(
			new IdTableSupportStandardImpl() {
				@Override
				public String generateIdTableName(String baseName) {
					final String name = super.generateIdTableName( baseName );
					return name.length() > 30 ? name.substring( 1, 30 ) : name;
				}

				@Override
				public String getCreateIdTableCommand() {
					return "create global temporary table";
				}

				@Override
				public String getCreateIdTableStatementOptions() {
					return "on commit delete rows";
				}
			},
			AfterUseAction.CLEAN
	);
}
 
Example 14
Source Project: lams   Source File: PostgreSQL81Dialect.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() {
	return new LocalTemporaryTableBulkIdStrategy(
			new IdTableSupportStandardImpl() {
				@Override
				public String getCreateIdTableCommand() {
					return "create temporary table";
				}

				@Override
				public String getCreateIdTableStatementOptions() {
					return "on commit drop";
				}
			},
			AfterUseAction.CLEAN,
			null
	);
}
 
Example 15
Source Project: lams   Source File: HANAColumnStoreDialect.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() {
	return new GlobalTemporaryTableBulkIdStrategy( new IdTableSupportStandardImpl() {

		@Override
		public String getCreateIdTableCommand() {
			return "create global temporary column table";
		}

		@Override
		public String getTruncateIdTableCommand() {
			return "truncate table";
		}

	}, AfterUseAction.CLEAN );
}
 
Example 16
Source Project: lams   Source File: StrategySelectorBuilder.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void addMultiTableBulkIdStrategies(StrategySelectorImpl strategySelector) {
	strategySelector.registerStrategyImplementor(
			MultiTableBulkIdStrategy.class,
			PersistentTableBulkIdStrategy.SHORT_NAME,
			PersistentTableBulkIdStrategy.class
	);
	strategySelector.registerStrategyImplementor(
			MultiTableBulkIdStrategy.class,
			GlobalTemporaryTableBulkIdStrategy.SHORT_NAME,
			GlobalTemporaryTableBulkIdStrategy.class
	);
	strategySelector.registerStrategyImplementor(
			MultiTableBulkIdStrategy.class,
			LocalTemporaryTableBulkIdStrategy.SHORT_NAME,
			LocalTemporaryTableBulkIdStrategy.class
	);
}
 
Example 17
Source Project: quarkus   Source File: QuarkusStrategySelectorBuilder.java    License: Apache License 2.0 5 votes vote down vote up
private static void addMultiTableBulkIdStrategies(StrategySelectorImpl strategySelector) {
    strategySelector.registerStrategyImplementor(
            MultiTableBulkIdStrategy.class,
            PersistentTableBulkIdStrategy.SHORT_NAME,
            PersistentTableBulkIdStrategy.class);
    strategySelector.registerStrategyImplementor(
            MultiTableBulkIdStrategy.class,
            GlobalTemporaryTableBulkIdStrategy.SHORT_NAME,
            GlobalTemporaryTableBulkIdStrategy.class);
    strategySelector.registerStrategyImplementor(
            MultiTableBulkIdStrategy.class,
            LocalTemporaryTableBulkIdStrategy.SHORT_NAME,
            LocalTemporaryTableBulkIdStrategy.class);
}
 
Example 18
@Override
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() {
	return new LocalTemporaryTableBulkIdStrategy(
			new IdTableSupportStandardImpl() {
				@Override
				public String generateIdTableName(String baseName) {
					return "#" + baseName;
				}
			},
			// sql-server, at least needed this dropped after use; strange!
			AfterUseAction.DROP,
			TempTableDdlTransactionHandling.NONE
	);
}
 
Example 19
Source Project: lams   Source File: HANARowStoreDialect.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() {
	return new GlobalTemporaryTableBulkIdStrategy( new IdTableSupportStandardImpl() {

		@Override
		public String getCreateIdTableCommand() {
			return "create global temporary row table";
		}
	}, AfterUseAction.CLEAN );
}
 
Example 20
public MultiTableUpdateExecutor(HqlSqlWalker walker) {
	MultiTableBulkIdStrategy strategy = walker.getSessionFactoryHelper()
			.getFactory()
			.getSessionFactoryOptions()
			.getMultiTableBulkIdStrategy();
	this.updateHandler = strategy.buildUpdateHandler( walker.getSessionFactoryHelper().getFactory(), walker );
}
 
Example 21
Source Project: lams   Source File: Settings.java    License: GNU General Public License v2.0 4 votes vote down vote up
public MultiTableBulkIdStrategy getMultiTableBulkIdStrategy() {
	return sessionFactoryOptions.getMultiTableBulkIdStrategy();
}
 
Example 22
Source Project: lams   Source File: TeradataDialect.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() {
	return new GlobalTemporaryTableBulkIdStrategy( this, AfterUseAction.CLEAN );
}
 
Example 23
Source Project: lams   Source File: Dialect.java    License: GNU General Public License v2.0 4 votes vote down vote up
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() {
	return new PersistentTableBulkIdStrategy();
}
 
Example 24
@Override
public MultiTableBulkIdStrategy getMultiTableBulkIdStrategy() {
	return delegate.getMultiTableBulkIdStrategy();
}
 
Example 25
@Override
public T applyMultiTableBulkIdStrategy(MultiTableBulkIdStrategy strategy) {
	delegate.applyMultiTableBulkIdStrategy( strategy );
	return getThis();
}
 
Example 26
@Override
public MultiTableBulkIdStrategy getMultiTableBulkIdStrategy() {
	return multiTableBulkIdStrategy;
}
 
Example 27
public void applyMultiTableBulkIdStrategy(MultiTableBulkIdStrategy strategy) {
	this.multiTableBulkIdStrategy = strategy;
}
 
Example 28
@Override
public SessionFactoryBuilder applyMultiTableBulkIdStrategy(MultiTableBulkIdStrategy strategy) {
	this.optionsBuilder.applyMultiTableBulkIdStrategy( strategy );
	return this;
}
 
Example 29
public MultiTableDeleteExecutor(HqlSqlWalker walker) {
	final MultiTableBulkIdStrategy strategy = walker.getSessionFactoryHelper().getFactory().getSessionFactoryOptions()
			.getMultiTableBulkIdStrategy();
	this.deleteHandler = strategy.buildDeleteHandler( walker.getSessionFactoryHelper().getFactory(), walker );
}
 
Example 30
Source Project: keycloak   Source File: DelegatingDialect.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() {
    return getInstance().getDefaultMultiTableBulkIdStrategy();
}