public IdentifierGeneratingInsert prepareIdentifierGeneratingInsert() { NoCommentsInsert insert = new NoCommentsInsert( dialect ); insert.addColumn( getPersister().getRootTableKeyColumnNames()[0], sequenceNextValFragment ); return insert; }
@Override public InsertGeneratedIdentifierDelegate getInsertGeneratedIdentifierDelegate( PostInsertIdentityPersister persister, Dialect dialect, boolean isGetGeneratedKeysEnabled) throws HibernateException { return new Delegate( persister, dialect, getSequenceName() ); }
@Override public synchronized Serializable generate(SharedSessionContractImplementor session, Object object) throws HibernateException { if ( sql != null ) { initializePreviousValueHolder( session ); } return previousValueHolder.makeValueThenIncrement(); }
private SelectGeneratorDelegate( PostInsertIdentityPersister persister, Dialect dialect, String suppliedUniqueKeyPropertyName) { super( persister ); this.persister = persister; this.dialect = dialect; this.uniqueKeyPropertyName = determineNameOfPropertyToUse( persister, suppliedUniqueKeyPropertyName ); idSelectString = persister.getSelectByUniqueKeyString( uniqueKeyPropertyName ); uniqueKeyType = persister.getPropertyType( uniqueKeyPropertyName ); idType = persister.getIdentifierType(); }
public BasicHolder(Class exactType) { this.exactType = exactType; if ( exactType != Long.class && exactType != Integer.class && exactType != Short.class ) { throw new IdentifierGenerationException( "Invalid type for basic integral holder : " + exactType ); } }
@Override public Serializable generate(SharedSessionContractImplementor session, Object obj) { return generateHolder( session ).makeValue(); }
@Override public Serializable generate(SharedSessionContractImplementor session, Object object) throws HibernateException { final Serializable context = generationContextLocator.locateGenerationContext( session, object ); for ( Object generationPlan : generationPlans ) { final GenerationPlan plan = (GenerationPlan) generationPlan; plan.execute( session, object, context ); } return context; }
public boolean eq(IntegralDataTypeHolder other) { return eq( extractLong( other ) ); }
/** * Getter for property 'role'. Role is the {@link #getPropertyName property name} qualified by the * {@link #getEntityName entity name}. * * @return Value for property 'role'. */ public String getRole() { return getEntityName() + '.' + getPropertyName(); }
public IntegralDataTypeHolder multiplyBy(IntegralDataTypeHolder factor) { return multiplyBy( extractLong( factor ) ); }
public boolean lt(IntegralDataTypeHolder other) { return lt( extractLong( other ) ); }
public boolean gt(IntegralDataTypeHolder other) { return gt( extractLong( other ) ); }
public InsertGeneratedIdentifierDelegate getInsertGeneratedIdentifierDelegate( PostInsertIdentityPersister persister, Dialect dialect, boolean isGetGeneratedKeysEnabled) throws HibernateException { return new SelectGeneratorDelegate( persister, dialect, uniqueKeyPropertyName ); }
public IntegralDataTypeHolder increment() { checkInitialized(); value++; return this; }
public ExportableColumn( Database database, Table table, String name, BasicType type, String dbTypeDeclaration) { super( name ); setValue( new ValueImpl( this, table, type, database ) ); setSqlType( dbTypeDeclaration ); }
public IntegralDataTypeHolder copy() { BasicHolder copy = new BasicHolder( exactType ); copy.value = value; return copy; }
@Override public void registerExportables(Database database) { for (GenerationPlan plan : generationPlans) { plan.registerExportables( database ); } } }
private void checkInitialized() { if ( value == Long.MIN_VALUE ) { throw new IdentifierGenerationException( "integral holder was not initialized" ); } }
public IntegralDataTypeHolder decrement() { checkInitialized(); value--; return this; }
private void checkInitialized() { if ( value == null ) { throw new IdentifierGenerationException( "integral holder was not initialized" ); } }