Package io.ebean.config
Class PlatformConfig
- java.lang.Object
-
- io.ebean.config.PlatformConfig
-
public class PlatformConfig extends Object
Configuration for DB types such as UUID, Geometry etc.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PlatformConfig.DbUuid
Specify how UUID is stored.
-
Constructor Summary
Constructors Constructor Description PlatformConfig()
Construct with defaults.PlatformConfig(PlatformConfig platformConfig)
Construct based on given config - typically for DbMigration generation with many platforms.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCustomMapping(DbType type, String columnDefinition)
Add a custom type mapping that applies to all platforms.void
addCustomMapping(DbType type, String columnDefinition, io.ebean.annotation.Platform platform)
Add a custom type mapping.DbConstraintNaming
getConstraintNaming()
List<CustomDbTypeMapping>
getCustomTypeMappings()
Return the list of custom type mappings.String
getDatabaseBooleanFalse()
Return a value used to represent FALSE in the database.String
getDatabaseBooleanTrue()
Return a value used to represent TRUE in the database.int
getDatabaseSequenceBatchSize()
Return the number of DB sequence values that should be preallocated.PlatformConfig.DbUuid
getDbUuid()
Return the DB type used to store UUID.int
getGeometrySRID()
Return the Geometry SRID.IdType
getIdType()
Return the IdType to use (or null for the default choice).boolean
isAllQuotedIdentifiers()
Return true if all DB column and table names should use quoted identifiers.boolean
isCaseSensitiveCollation()
Return true if the collation is case sensitive.boolean
isDatabaseInetAddressVarchar()
Return true if InetAddress should map to varchar column (rather than Postgres INET).boolean
isForUpdateNoKey()
Return true if Postgres FOR UPDATE should use the NO KEY option.void
loadSettings(PropertiesWrapper p)
void
setAllQuotedIdentifiers(boolean allQuotedIdentifiers)
Set to true if all DB column and table names should use quoted identifiers.void
setCaseSensitiveCollation(boolean caseSensitiveCollation)
Set to false to indicate that the collation is case insensitive.void
setConstraintNaming(DbConstraintNaming constraintNaming)
Set a custom database constraint naming convention.void
setDatabaseBooleanFalse(String databaseBooleanFalse)
Set the value used to represent FALSE in the database.void
setDatabaseBooleanTrue(String databaseBooleanTrue)
Set the value to represent TRUE in the database.void
setDatabaseInetAddressVarchar(boolean databaseInetAddressVarchar)
Set to true to force InetAddress to map to varchar column.void
setDatabaseSequenceBatchSize(int databaseSequenceBatchSize)
Set the number of DB sequence values that should be preallocated.void
setDbUuid(PlatformConfig.DbUuid dbUuid)
Set the DB type used to store UUID.void
setForUpdateNoKey(boolean forUpdateNoKey)
Set to true such that Postgres FOR UPDATE should use the NO KEY option.void
setGeometrySRID(int geometrySRID)
Set the Geometry SRID.void
setIdType(IdType idType)
Set the IdType to use (when the DB supports both SEQUENCE and IDENTITY and the default is not desired).
-
-
-
Constructor Detail
-
PlatformConfig
public PlatformConfig()
Construct with defaults.
-
PlatformConfig
public PlatformConfig(PlatformConfig platformConfig)
Construct based on given config - typically for DbMigration generation with many platforms.
-
-
Method Detail
-
getConstraintNaming
public DbConstraintNaming getConstraintNaming()
-
setConstraintNaming
public void setConstraintNaming(DbConstraintNaming constraintNaming)
Set a custom database constraint naming convention.
-
isAllQuotedIdentifiers
public boolean isAllQuotedIdentifiers()
Return true if all DB column and table names should use quoted identifiers.
-
setAllQuotedIdentifiers
public void setAllQuotedIdentifiers(boolean allQuotedIdentifiers)
Set to true if all DB column and table names should use quoted identifiers.
-
isCaseSensitiveCollation
public boolean isCaseSensitiveCollation()
Return true if the collation is case sensitive.
-
setCaseSensitiveCollation
public void setCaseSensitiveCollation(boolean caseSensitiveCollation)
Set to false to indicate that the collation is case insensitive.
-
isForUpdateNoKey
public boolean isForUpdateNoKey()
Return true if Postgres FOR UPDATE should use the NO KEY option.
-
setForUpdateNoKey
public void setForUpdateNoKey(boolean forUpdateNoKey)
Set to true such that Postgres FOR UPDATE should use the NO KEY option.
-
getDatabaseBooleanTrue
public String getDatabaseBooleanTrue()
Return a value used to represent TRUE in the database.This is used for databases that do not support boolean natively.
The value returned is either a Integer or a String (e.g. "1", or "T").
-
setDatabaseBooleanTrue
public void setDatabaseBooleanTrue(String databaseBooleanTrue)
Set the value to represent TRUE in the database.This is used for databases that do not support boolean natively.
The value set is either a Integer or a String (e.g. "1", or "T").
-
getDatabaseBooleanFalse
public String getDatabaseBooleanFalse()
Return a value used to represent FALSE in the database.
-
setDatabaseBooleanFalse
public void setDatabaseBooleanFalse(String databaseBooleanFalse)
Set the value used to represent FALSE in the database.
-
getDatabaseSequenceBatchSize
public int getDatabaseSequenceBatchSize()
Return the number of DB sequence values that should be preallocated.
-
setDatabaseSequenceBatchSize
public void setDatabaseSequenceBatchSize(int databaseSequenceBatchSize)
Set the number of DB sequence values that should be preallocated.
-
getGeometrySRID
public int getGeometrySRID()
Return the Geometry SRID.
-
setGeometrySRID
public void setGeometrySRID(int geometrySRID)
Set the Geometry SRID.
-
getDbUuid
public PlatformConfig.DbUuid getDbUuid()
Return the DB type used to store UUID.
-
setDbUuid
public void setDbUuid(PlatformConfig.DbUuid dbUuid)
Set the DB type used to store UUID.
-
setIdType
public void setIdType(IdType idType)
Set the IdType to use (when the DB supports both SEQUENCE and IDENTITY and the default is not desired).
-
isDatabaseInetAddressVarchar
public boolean isDatabaseInetAddressVarchar()
Return true if InetAddress should map to varchar column (rather than Postgres INET).
-
setDatabaseInetAddressVarchar
public void setDatabaseInetAddressVarchar(boolean databaseInetAddressVarchar)
Set to true to force InetAddress to map to varchar column.
-
addCustomMapping
public void addCustomMapping(DbType type, String columnDefinition, io.ebean.annotation.Platform platform)
Add a custom type mapping.// set the default mapping for BigDecimal.class/decimal config.addCustomMapping(DbType.DECIMAL, "decimal(18,6)"); // set the default mapping for String.class/varchar but only for Postgres config.addCustomMapping(DbType.VARCHAR, "text", Platform.POSTGRES);
- Parameters:
type
- The DB type this mapping should apply tocolumnDefinition
- The column definition that should be usedplatform
- Optionally specify the platform this mapping should apply to.
-
addCustomMapping
public void addCustomMapping(DbType type, String columnDefinition)
Add a custom type mapping that applies to all platforms.// set the default mapping for BigDecimal/decimal config.addCustomMapping(DbType.DECIMAL, "decimal(18,6)"); // set the default mapping for String/varchar config.addCustomMapping(DbType.VARCHAR, "text");
- Parameters:
type
- The DB type this mapping should apply tocolumnDefinition
- The column definition that should be used
-
getCustomTypeMappings
public List<CustomDbTypeMapping> getCustomTypeMappings()
Return the list of custom type mappings.
-
loadSettings
public void loadSettings(PropertiesWrapper p)
-
-