question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exposed-money: can't access currency and amount for nullable compositeMoney columns

See original GitHub issue
object 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:open
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jnfeinsteincommented, Dec 23, 2020

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:

typealias NullableMoneyColumn = CompositeMoneyColumn<*, *, MonetaryAmount?>

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.

0reactions
Tapaccommented, Jan 5, 2021

@jnfeinstein , thank you for the idea. That sounds like a plan. I will try to extend the CompositeColumn class with default implementation,

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found