google-nomulus/core
Weimin Yu fb8864acef Properly handle Joda Money in JPA (#1447)
* 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.
2021-12-03 13:52:21 -05:00
..
gradle/dependency-locks Implement a util class to manage push queues using Cloud Tasks API (#1290) 2021-08-24 21:13:54 -04:00
src Properly handle Joda Money in JPA (#1447) 2021-12-03 13:52:21 -05:00
build.gradle Validate SQL with Datastore being Primary (#1436) 2021-11-30 12:57:49 -05:00
Dockerfile Build docker image of nomulus tool (#142) 2019-07-16 20:18:44 -04:00