Exposed-money: can't access currency and amount for nullable compositeMoney columns
See original GitHub issueobject Article : IntIdTable() {
val name = varchar("name", 100).nullable()
val price = compositeMoney(10, 5,"price").nullable()
}
cant reference the amount and currency : Article.price.amount
because nullable()
here returns CompositeColumn
and not CompositeMoneyColumn
As a workaround we can do a cast:
object Article : IntIdTable() {
val name = varchar("name", 100).nullable()
val price = compositeMoney(10, 5,"price").nullable() as CompositeMoneyColumn<BigDecimal?, CurrencyUnit?, MonetaryAmount?>
}
Same thing for default()
method
I suggest to make improvement so that we can manage better compositeMoney columns. @Tapac , any thoughts?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Format a number or currency field - Microsoft Support
Custom formats for numbers and currency fields in Access can be useful when you want the ... Defines what users see when a...
Read more >What's wrong with nullable columns in composite primary keys?
In Sql Server a unique constraint that has a nullable column, allows the value 'null' in that column only once (given identical values...
Read more >GP 2015 Year End Close Error - Cannot Insert Null Value...
GP 2015 Year End Close Error - Cannot Insert Null Value in to Column ... Uncheck all the currency ID and pop-up window...
Read more >Trying to get the sum of the column containing Currency ...
Hello I am trying to get the sum of a column which has currency values. Tried to replace the value and add it...
Read more >Sorting and null for monetary values in a report — oracle-tech
I want the column to show the UK Pound sign, be sortable, ... I can't think how to get it to leave that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve run into this as well and also used casting to fix the issue. The issue is here, where we cast the column as nullable, thereby losing the composite typing. @hfazai I have this:
so you can do
as NullableMoneyColumn
. I also recall the nullable generics on the composite money column being inconsistent, like sometimes you can put in nulls but not take them out or vice versa.@jnfeinstein , thank you for the idea. That sounds like a plan. I will try to extend the CompositeColumn class with default implementation,