[英]Inserting data to a PostgreSQL jsonb column via Scala Anorm (in Play Framework)
[英]PostgreSQL numeric type and anorm parser with Play! scala 2.3
我想使用Postgresql 9.3的數字類型,但是我的解析器是:
private val Account403Parser: RowParser[Account403] = {
get[Long]("id") ~
get[Float]("amount") map {
case id ~ amount =>
Account403.apply(id, amount)
}
無法正常運行,因為主動脈無法從java.math.BigDecimal轉換為Float。
這是我得到的錯誤:
[RuntimeException: TypeDoesNotMatch(Cannot convert 9.5: class java.math.BigDecimal to Float for column ColumnName(account403.amount,Some(amount)))]
如何更改解析器以使其從java.math.BigDecimal類型轉換為Float類型?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.