当前位置: 首页>>代码示例>>Java>>正文


Java IntegralDataTypeHolder类代码示例

本文整理汇总了Java中org.hibernate.id.IntegralDataTypeHolder的典型用法代码示例。如果您正苦于以下问题:Java IntegralDataTypeHolder类的具体用法?Java IntegralDataTypeHolder怎么用?Java IntegralDataTypeHolder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IntegralDataTypeHolder类属于org.hibernate.id包,在下文中一共展示了IntegralDataTypeHolder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: insert

import org.hibernate.id.IntegralDataTypeHolder; //导入依赖的package包/类
/**
 * Makes insert of last value of identifier
 * 
 * @param connection
 * @param value
 * @throws SQLException
 */
private void insert(Connection connection, IntegralDataTypeHolder value)
	throws SQLException {

    PreparedStatement insertPS = null;
    try {
	statementLogger.logStatement(insertQuery,
		FormatStyle.BASIC.getFormatter());
	insertPS = connection.prepareStatement(insertQuery);
	insertPS.setString(FIRST_COLUMN, segmentValue);
	value.bind(insertPS, SECOND_COLUMN);
	insertPS.execute();
    } finally {
	close(insertPS);
    }
}
 
开发者ID:levants,项目名称:lightmare,代码行数:23,代码来源:TableGeneratorExt.java

示例2: onSelect

import org.hibernate.id.IntegralDataTypeHolder; //导入依赖的package包/类
private void onSelect(Connection connection,
	IntegralDataTypeHolder value) throws SQLException {

    PreparedStatement selectPS = connection
	    .prepareStatement(selectQuery);
    try {
	selectPS.setString(FIRST_COLUMN, segmentValue);
	ResultSet selectRS = selectPS.executeQuery();
	if (selectRS.next()) {
	    value.initialize(selectRS, FIRST_COLUMN);
	} else {
	    value.initialize(currentValue);
	    insert(connection, value);
	}
	selectRS.close();
    } catch (SQLException ex) {
	LOG.unableToReadOrInitHiValue(ex);
	throw ex;
    } finally {
	selectPS.close();
    }
}
 
开发者ID:levants,项目名称:lightmare,代码行数:23,代码来源:TableGeneratorExt.java

示例3: execute

import org.hibernate.id.IntegralDataTypeHolder; //导入依赖的package包/类
@Override
public IntegralDataTypeHolder execute(Connection connection)
	throws SQLException {
    IntegralDataTypeHolder value = IdentifierGeneratorHelper
	    .getIntegralDataTypeHolder(identifierType
		    .getReturnedClass());
    int rows;
    do {
	statementLogger.logStatement(selectQuery,
		FormatStyle.BASIC.getFormatter());
	onSelect(connection, value);
	statementLogger.logStatement(updateQuery,
		FormatStyle.BASIC.getFormatter());
	rows = onUpdate(connection, value);
    } while (rows == ZERO_ROWS);

    return value;
}
 
开发者ID:levants,项目名称:lightmare,代码行数:19,代码来源:TableGeneratorExt.java

示例4: generate

import org.hibernate.id.IntegralDataTypeHolder; //导入依赖的package包/类
@Override
public Serializable generate(AccessCallback callback) {
	// IMPL NOTE : this method is called concurrently and is
	// not synchronized. It is very important to work on the
	// local variable: the field lastSourceValue is not
	// reliable as it might be mutated by multipled threads.
	// The lastSourceValue field is only accessed by tests,
	// so this is not a concern.
	IntegralDataTypeHolder value = null;
	while ( value == null || value.lt( 1 ) ) {
		value = callback.getNextValue();
	}
	lastSourceValue = value;
	return value.makeValue();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:NoopOptimizer.java

示例5: getNextValue

import org.hibernate.id.IntegralDataTypeHolder; //导入依赖的package包/类
@Override
public IntegralDataTypeHolder getNextValue() {
    ReturningWork returnWork = new ReturningWork(statementLogger,
	    currentValue);
    return session.getTransactionCoordinator().getTransaction()
	    .createIsolationDelegate()
	    .delegateWork(returnWork, Boolean.TRUE);
}
 
开发者ID:levants,项目名称:lightmare,代码行数:9,代码来源:TableGeneratorExt.java

示例6: getLastSourceValue

import org.hibernate.id.IntegralDataTypeHolder; //导入依赖的package包/类
@Override
public IntegralDataTypeHolder getLastSourceValue() {
	return noTenantGenerationState().lastSourceValue;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:PooledLoOptimizer.java

示例7: getLastSourceValue

import org.hibernate.id.IntegralDataTypeHolder; //导入依赖的package包/类
@Override
public synchronized IntegralDataTypeHolder getLastSourceValue() {
	return noTenantGenerationState().lastSourceValue.copy();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:LegacyHiLoAlgorithmOptimizer.java

示例8: makeValue

import org.hibernate.id.IntegralDataTypeHolder; //导入依赖的package包/类
private IntegralDataTypeHolder makeValue() {
	return IdentifierGeneratorHelper.getIntegralDataTypeHolder( identifierType.getReturnedClass() );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:TableGenerator.java

示例9: getLastSourceValue

import org.hibernate.id.IntegralDataTypeHolder; //导入依赖的package包/类
@Override
public IntegralDataTypeHolder getLastSourceValue() {
	return lastSourceValue;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:NoopOptimizer.java

示例10: makeValue

import org.hibernate.id.IntegralDataTypeHolder; //导入依赖的package包/类
private IntegralDataTypeHolder makeValue() {
	return IdentifierGeneratorHelper.getIntegralDataTypeHolder( numberType );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:TableStructure.java

示例11: buildCallback

import org.hibernate.id.IntegralDataTypeHolder; //导入依赖的package包/类
@Override
public AccessCallback buildCallback(final SessionImplementor session) {
	final SqlStatementLogger statementLogger = session.getFactory().getServiceRegistry()
			.getService( JdbcServices.class )
			.getSqlStatementLogger();
	final SessionEventListenerManager statsCollector = session.getEventListenerManager();

	return new AccessCallback() {
		@Override
		public IntegralDataTypeHolder getNextValue() {
			return session.getTransactionCoordinator().getTransaction().createIsolationDelegate().delegateWork(
					new AbstractReturningWork<IntegralDataTypeHolder>() {
						@Override
						public IntegralDataTypeHolder execute(Connection connection) throws SQLException {
							final IntegralDataTypeHolder value = makeValue();
							int rows;
							do {
								final PreparedStatement selectStatement = prepareStatement( connection, selectQuery, statementLogger, statsCollector );
								try {
									final ResultSet selectRS = executeQuery( selectStatement, statsCollector );
									if ( !selectRS.next() ) {
										final String err = "could not read a hi value - you need to populate the table: " + tableName;
										LOG.error( err );
										throw new IdentifierGenerationException( err );
									}
									value.initialize( selectRS, 1 );
									selectRS.close();
								}
								catch (SQLException sqle) {
									LOG.error( "could not read a hi value", sqle );
									throw sqle;
								}
								finally {
									selectStatement.close();
								}


								final PreparedStatement updatePS = prepareStatement( connection, updateQuery, statementLogger, statsCollector );
								try {
									final int increment = applyIncrementSizeToSourceValues ? incrementSize : 1;
									final IntegralDataTypeHolder updateValue = value.copy().add( increment );
									updateValue.bind( updatePS, 1 );
									value.bind( updatePS, 2 );
									rows = executeUpdate( updatePS, statsCollector );
								}
								catch (SQLException e) {
									LOG.unableToUpdateQueryHiValue( tableName, e );
									throw e;
								}
								finally {
									updatePS.close();
								}
							} while ( rows == 0 );

							accessCounter++;

							return value;
						}
					},
					true
			);
		}

		@Override
		public String getTenantIdentifier() {
			return session.getTenantIdentifier();
		}
	};
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:70,代码来源:TableStructure.java

示例12: getLastSourceValue

import org.hibernate.id.IntegralDataTypeHolder; //导入依赖的package包/类
@Override
public synchronized IntegralDataTypeHolder getLastSourceValue() {
	return noTenantGenerationState().lastSourceValue;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:HiLoOptimizer.java

示例13: getLastSourceValue

import org.hibernate.id.IntegralDataTypeHolder; //导入依赖的package包/类
@Override
public IntegralDataTypeHolder getLastSourceValue() {
	return noTenantGenerationState().hiValue;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:PooledOptimizer.java

示例14: buildCallback

import org.hibernate.id.IntegralDataTypeHolder; //导入依赖的package包/类
@Override
public AccessCallback buildCallback(final SessionImplementor session) {
	return new AccessCallback() {
		@Override
		public IntegralDataTypeHolder getNextValue() {
			accessCounter++;
			try {
				final PreparedStatement st = session.getTransactionCoordinator().getJdbcCoordinator().getStatementPreparer().prepareStatement( sql );
				try {
					final ResultSet rs = session.getTransactionCoordinator().getJdbcCoordinator().getResultSetReturn().extract( st );
					try {
						rs.next();
						final IntegralDataTypeHolder value = IdentifierGeneratorHelper.getIntegralDataTypeHolder( numberType );
						value.initialize( rs, 1 );
						if ( LOG.isDebugEnabled() ) {
							LOG.debugf( "Sequence value obtained: %s", value.makeValue() );
						}
						return value;
					}
					finally {
						try {
							session.getTransactionCoordinator().getJdbcCoordinator().release( rs, st );
						}
						catch( Throwable ignore ) {
							// intentionally empty
						}
					}
				}
				finally {
					session.getTransactionCoordinator().getJdbcCoordinator().release( st );
				}

			}
			catch ( SQLException sqle) {
				throw session.getFactory().getSQLExceptionHelper().convert(
						sqle,
						"could not get next sequence value",
						sql
				);
			}
		}

		@Override
		public String getTenantIdentifier() {
			return session.getTenantIdentifier();
		}
	};
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:49,代码来源:SequenceStructure.java

示例15: nextValue

import org.hibernate.id.IntegralDataTypeHolder; //导入依赖的package包/类
@Override
public void nextValue(RowKey key, IntegralDataTypeHolder value, int increment, int initialValue) {
    throw new NotImplementedException("구현 중");
}
 
开发者ID:debop,项目名称:debop4j,代码行数:5,代码来源:RedisDialect.java


注:本文中的org.hibernate.id.IntegralDataTypeHolder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。