public class PlatformConfig extends Object
Modifier and Type | Class and Description |
---|---|
static class |
PlatformConfig.DbUuid
Specify how UUID is stored.
|
Constructor and Description |
---|
PlatformConfig()
Construct with defaults.
|
PlatformConfig(PlatformConfig platformConfig)
Construct based on given config - typically for DbMigration generation with many platforms.
|
Modifier and Type | Method and 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.
|
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 |
isDatabaseInetAddressVarchar()
Return true if InetAddress should map to varchar column (rather than Postgres INET).
|
void |
loadSettings(PropertiesWrapper p) |
void |
setAllQuotedIdentifiers(boolean allQuotedIdentifiers)
Set to true if all DB column and table names should use quoted identifiers.
|
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 |
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).
|
public PlatformConfig()
public PlatformConfig(PlatformConfig platformConfig)
public boolean isAllQuotedIdentifiers()
public void setAllQuotedIdentifiers(boolean allQuotedIdentifiers)
public String getDatabaseBooleanTrue()
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").
public void setDatabaseBooleanTrue(String databaseBooleanTrue)
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").
public String getDatabaseBooleanFalse()
public void setDatabaseBooleanFalse(String databaseBooleanFalse)
public int getDatabaseSequenceBatchSize()
public void setDatabaseSequenceBatchSize(int databaseSequenceBatchSize)
public int getGeometrySRID()
public void setGeometrySRID(int geometrySRID)
public PlatformConfig.DbUuid getDbUuid()
public void setDbUuid(PlatformConfig.DbUuid dbUuid)
public void setIdType(IdType idType)
public boolean isDatabaseInetAddressVarchar()
public void setDatabaseInetAddressVarchar(boolean databaseInetAddressVarchar)
public void addCustomMapping(DbType type, String columnDefinition, io.ebean.annotation.Platform platform)
// set the default mapping for BigDecimal.class/decimal
serverConfig.addCustomMapping(DbType.DECIMAL, "decimal(18,6)");
// set the default mapping for String.class/varchar but only for Postgres
serverConfig.addCustomMapping(DbType.VARCHAR, "text", Platform.POSTGRES);
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.public void addCustomMapping(DbType type, String columnDefinition)
// set the default mapping for BigDecimal/decimal
serverConfig.addCustomMapping(DbType.DECIMAL, "decimal(18,6)");
// set the default mapping for String/varchar
serverConfig.addCustomMapping(DbType.VARCHAR, "text");
type
- The DB type this mapping should apply tocolumnDefinition
- The column definition that should be usedpublic List<CustomDbTypeMapping> getCustomTypeMappings()
public void loadSettings(PropertiesWrapper p)
Copyright © 2019. All rights reserved.