Search in sources :

Example 6 with DfSequenceIdentityProperties

use of org.dbflute.properties.DfSequenceIdentityProperties in project dbflute-core by dbflute.

the class Table method getSequenceCacheSize.

public Integer getSequenceCacheSize() {
    if (!isUseSequence()) {
        return null;
    }
    final DfSequenceIdentityProperties prop = getSequenceIdentityProperties();
    final DfSchemaSource ds = getDatabase().getDataSource();
    return prop.getSequenceCacheSize(ds, getUnifiedSchema(), getTableDbName());
}
Also used : DfSchemaSource(org.dbflute.helper.jdbc.context.DfSchemaSource) DfSequenceIdentityProperties(org.dbflute.properties.DfSequenceIdentityProperties)

Example 7 with DfSequenceIdentityProperties

use of org.dbflute.properties.DfSequenceIdentityProperties in project dbflute-core by dbflute.

the class Table method getSequenceReturnType.

public String getSequenceReturnType() {
    final DfSequenceIdentityProperties sequenceIdentityProperties = getProperties().getSequenceIdentityProperties();
    final String sequenceReturnType = sequenceIdentityProperties.getSequenceReturnType();
    if (hasCompoundPrimaryKey()) {
        return sequenceReturnType;
    }
    final Column primaryKeyAsOne = getPrimaryKeyAsOne();
    if (primaryKeyAsOne.isJavaNativeNumberObject()) {
        return primaryKeyAsOne.getJavaNative();
    }
    return sequenceReturnType;
}
Also used : DfSequenceIdentityProperties(org.dbflute.properties.DfSequenceIdentityProperties)

Example 8 with DfSequenceIdentityProperties

use of org.dbflute.properties.DfSequenceIdentityProperties in project dbflute-core by dbflute.

the class Table method isUseIdentity.

// ===================================================================================
// Identity
// ========
/**
 * Determine whether this table uses an identity.
 * @return The determination, true or false.
 */
public boolean isUseIdentity() {
    final DfBasicProperties basicProperties = getBasicProperties();
    // because serial type is treated as sequence
    if (basicProperties.isDatabasePostgreSQL()) {
        return false;
    }
    // It gives priority to auto-increment information of JDBC.
    if (hasAutoIncrementColumn()) {
        return true;
    }
    final DfSequenceIdentityProperties prop = getSequenceIdentityProperties();
    return prop.getIdentityColumnName(getTableDbName()) != null;
}
Also used : DfSequenceIdentityProperties(org.dbflute.properties.DfSequenceIdentityProperties) DfBasicProperties(org.dbflute.properties.DfBasicProperties)

Example 9 with DfSequenceIdentityProperties

use of org.dbflute.properties.DfSequenceIdentityProperties in project dbflute-core by dbflute.

the class Table method getIdentityColumn.

protected Column getIdentityColumn() {
    if (!isUseIdentity()) {
        return null;
    }
    // It gives priority to auto-increment information of JDBC.
    final Column autoIncrementColumn = getAutoIncrementColumn();
    if (autoIncrementColumn != null) {
        return autoIncrementColumn;
    }
    final DfSequenceIdentityProperties prop = getSequenceIdentityProperties();
    final String columnName = prop.getIdentityColumnName(getTableDbName());
    final Column column = getColumn(columnName);
    if (column == null) {
        String msg = "The columnName does not exist in the table: ";
        msg = msg + " tableName=" + getTableDbName() + " columnName=" + columnName;
        msg = msg + " columnList=" + getColumnNameCommaString();
        throw new IllegalStateException(msg);
    }
    return column;
}
Also used : DfSequenceIdentityProperties(org.dbflute.properties.DfSequenceIdentityProperties)

Aggregations

DfSequenceIdentityProperties (org.dbflute.properties.DfSequenceIdentityProperties)9 DfSchemaSource (org.dbflute.helper.jdbc.context.DfSchemaSource)4 BigDecimal (java.math.BigDecimal)2 DfRepsSequenceHandlerFactory (org.dbflute.logic.replaceschema.takefinally.sequence.factory.DfRepsSequenceHandlerFactory)1 DfBasicProperties (org.dbflute.properties.DfBasicProperties)1 DfDatabaseProperties (org.dbflute.properties.DfDatabaseProperties)1 DfDatabaseTypeFacadeProp (org.dbflute.properties.facade.DfDatabaseTypeFacadeProp)1