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

The following examples show how to use org.hibernate.hql.spi.id.MultiTableBulkIdStrategy. 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 File: SAPDBDialect.java    From lams with 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 #2
Source File: PostgreSQL81Dialect.java    From lams with 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 #3
Source File: TimesTenDialect.java    From lams with 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 #4
Source File: Cache71Dialect.java    From lams with 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 #5
Source File: DB2Dialect.java    From lams with 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 #6
Source File: IngresDialect.java    From lams with 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 #7
Source File: Oracle9Dialect.java    From lams with 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 #8
Source File: HANAColumnStoreDialect.java    From lams with 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 #9
Source File: InformixDialect.java    From lams with 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 #10
Source File: PostgreSQL82Dialect.java    From lams with 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 #11
Source File: Oracle8iDialect.java    From lams with 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 #12
Source File: MySQLDialect.java    From lams with 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 #13
Source File: H2Dialect.java    From lams with 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 #14
Source File: DerbyDialect.java    From lams with 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 #15
Source File: DB297Dialect.java    From lams with 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 #16
Source File: StrategySelectorBuilder.java    From lams with 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 File: QuarkusStrategySelectorBuilder.java    From quarkus with 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
Source File: MultiTableUpdateExecutor.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public MultiTableUpdateExecutor(HqlSqlWalker walker) {
	MultiTableBulkIdStrategy strategy = walker.getSessionFactoryHelper()
			.getFactory()
			.getSessionFactoryOptions()
			.getMultiTableBulkIdStrategy();
	this.updateHandler = strategy.buildUpdateHandler( walker.getSessionFactoryHelper().getFactory(), walker );
}
 
Example #19
Source File: HANARowStoreDialect.java    From lams with 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
Source File: AbstractTransactSQLDialect.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@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 #21
Source File: MultiTableDeleteExecutor.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public MultiTableDeleteExecutor(HqlSqlWalker walker) {
	final MultiTableBulkIdStrategy strategy = walker.getSessionFactoryHelper().getFactory().getSessionFactoryOptions()
			.getMultiTableBulkIdStrategy();
	this.deleteHandler = strategy.buildDeleteHandler( walker.getSessionFactoryHelper().getFactory(), walker );
}
 
Example #22
Source File: DelegatingDialect.java    From keycloak with Apache License 2.0 4 votes vote down vote up
@Override
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() {
    return getInstance().getDefaultMultiTableBulkIdStrategy();
}
 
Example #23
Source File: SessionFactoryBuilderImpl.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public SessionFactoryBuilder applyMultiTableBulkIdStrategy(MultiTableBulkIdStrategy strategy) {
	this.optionsBuilder.applyMultiTableBulkIdStrategy( strategy );
	return this;
}
 
Example #24
Source File: SessionFactoryOptionsBuilder.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public void applyMultiTableBulkIdStrategy(MultiTableBulkIdStrategy strategy) {
	this.multiTableBulkIdStrategy = strategy;
}
 
Example #25
Source File: SessionFactoryOptionsBuilder.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public MultiTableBulkIdStrategy getMultiTableBulkIdStrategy() {
	return multiTableBulkIdStrategy;
}
 
Example #26
Source File: AbstractDelegatingSessionFactoryBuilder.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public T applyMultiTableBulkIdStrategy(MultiTableBulkIdStrategy strategy) {
	delegate.applyMultiTableBulkIdStrategy( strategy );
	return getThis();
}
 
Example #27
Source File: AbstractDelegatingSessionFactoryOptions.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public MultiTableBulkIdStrategy getMultiTableBulkIdStrategy() {
	return delegate.getMultiTableBulkIdStrategy();
}
 
Example #28
Source File: Dialect.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() {
	return new PersistentTableBulkIdStrategy();
}
 
Example #29
Source File: TeradataDialect.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() {
	return new GlobalTemporaryTableBulkIdStrategy( this, AfterUseAction.CLEAN );
}
 
Example #30
Source File: Settings.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public MultiTableBulkIdStrategy getMultiTableBulkIdStrategy() {
	return sessionFactoryOptions.getMultiTableBulkIdStrategy();
}