本文整理汇总了Java中org.hibernate.id.enhanced.AccessCallback类的典型用法代码示例。如果您正苦于以下问题:Java AccessCallback类的具体用法?Java AccessCallback怎么用?Java AccessCallback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AccessCallback类属于org.hibernate.id.enhanced包,在下文中一共展示了AccessCallback类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generate
import org.hibernate.id.enhanced.AccessCallback; //导入依赖的package包/类
public synchronized Serializable generate(final SessionImplementor session, Object obj) {
// maxLo < 1 indicates a hilo generator with no hilo :?
if ( maxLo < 1 ) {
//keep the behavior consistent even for boundary usages
IntegralDataTypeHolder value = null;
while ( value == null || value.lt( 0 ) ) {
value = super.generateHolder( session );
}
return value.makeValue();
}
return hiloOptimizer.generate(
new AccessCallback() {
public IntegralDataTypeHolder getNextValue() {
return generateHolder( session );
}
@Override
public String getTenantIdentifier() {
return session.getTenantIdentifier();
}
}
);
}
示例2: generate
import org.hibernate.id.enhanced.AccessCallback; //导入依赖的package包/类
@Override
public synchronized Serializable generate(final SessionImplementor session, Object obj) {
// maxLo < 1 indicates a hilo generator with no hilo :?
if ( maxLo < 1 ) {
//keep the behavior consistent even for boundary usages
IntegralDataTypeHolder value = null;
while ( value == null || value.lt( 0 ) ) {
value = generateHolder( session );
}
return value.makeValue();
}
return hiloOptimizer.generate(
new AccessCallback() {
public IntegralDataTypeHolder getNextValue() {
return generateHolder( session );
}
@Override
public String getTenantIdentifier() {
return session.getTenantIdentifier();
}
}
);
}
示例3: generateIncrementally
import org.hibernate.id.enhanced.AccessCallback; //导入依赖的package包/类
/**
* Updates (or inserts) table column value with existing id
*
* @param session
* @param currentValue
* @return {@link Serializable}
*/
public Serializable generateIncrementally(final SessionImplementor session,
final long currentValue) {
final SqlStatementLogger statementLogger = session.getFactory()
.getServiceRegistry().getService(JdbcServices.class)
.getSqlStatementLogger();
final AccessCallback callback = new AccessCallbackImpl(session,
currentValue, statementLogger);
return optimizer.generate(callback);
}