Numeric
Numeric types are mapped to appropriate database types depending on the platform.
BigDecimal
By default BigDecimal maps to database decimal(16,3)
. This default can
be changed via databaseConfig.addCustomMapping():
// set the default mapping for BigDecimal.class/decimal
databaseConfig.addCustomMapping(DbType.DECIMAL, "decimal(8,2)");
Decimal precision and scale
Explicitly specify decimal precision and scale using @Column
.
@Column(precision = 10, scale = 4)
BigDecimal approvalRate;
primitive types
Primitive types are deemed non nullable. Ebean will generate DDL for these as not nullable.
// primitive type deemed non nullable
long approvalTotal;