I am using SORM as ORM in Scalatra application. I use Create
as the initMode
so that the tables are created automatically. I have a BigDecimal field as part of a case class, as below:
case class Invoice(invoiceId: String, invoiceAmount: BigDecimal)
There are 2 questions for which I am looking for the answers (might be it is just one answer):
Is unboxed tagged types
the way to go?
Tagged
types is the only way out to have default precision for BigDecimal in case class.SORM
by default uses DECIMAL(65,30)
as the column's datatype for Decimal types. Which means you cannot set the precision of the database column unless you create the tables yourself, or customize StdCreateTable.scala
to handle that appropriately.