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(); } } ); }
@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(); } } ); }
/** * 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); }