mirror of
https://github.com/google/nomulus.git
synced 2025-07-20 01:35:59 +02:00
* Properly handle Joda Money in JPA Joda Money has BigDecimal as amount, which is mapped to a numeric(19,2) column in the database. As a result, the Money amount load from DB has scale 2. This becomes a problem with currencies such as JPY, which requires scale to be 0. To properly load a currency, we must adjust the scale post-load. The current approach, which uses Hibernate component mapping, puts the burden of post-load cleanup on each entity type that uses Money. It is easy to forget this, as we just discovered. This PR uses a CompositeUserType to map Money. It adjusts the scale properly when loading Money instances. Although CompositeUserType appear to be deprecated in Hibernate 6, it is the only proper solution right now for mapping non-owned classes. |
||
---|---|---|
.. | ||
gradle/dependency-locks | ||
src | ||
build.gradle | ||
Dockerfile |