Skip to content

Commit

Permalink
#346 - Upgrade to Moneta 1.4.2 on 7.3.x.
Browse files Browse the repository at this point in the history
Tweaked the implementation of MonetaryAmountAttributeConverter to workaround JavaMoney/jsr354-ri#357, as in 1.4 the toString() method returns a formatted value. We now extract currency code and numeric value explicitly ourselves.

[This is a cherry-pick of e99e67b in main, see issue #345.]
  • Loading branch information
odrotbohm authored and martinmo committed Jun 1, 2021
1 parent ce924bd commit 89174f5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@
<dependency>
<groupId>org.javamoney.moneta</groupId>
<artifactId>moneta-core</artifactId>
<version>1.4-tud</version>
<version>1.4.2</version>
</dependency>

<!-- For changelog creation -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class MonetaryAmountAttributeConverter implements AttributeConverter<MonetaryAmo
*/
@Override
public String convertToDatabaseColumn(MonetaryAmount amount) {
return amount == null ? null : amount.toString();
return amount == null ? null : String.format("%s %s", amount.getCurrency().getCurrencyCode(), amount.getNumber());
}

/*
Expand Down

0 comments on commit 89174f5

Please sign in to comment.