Joda-Money provides a Java library of classes to store money amount.
Questions tagged [joda-money]
21 questions
12
votes
6 answers
Joda-Money persistence via hibernate
There is a library for JodaTime that provides Hibernate persistence. Recently I started looking at Joda-Money and started to see how that can be persisted using hibernate and I do not see any library.
Any suggestions?

Sudarshan
- 8,574
- 11
- 52
- 74
7
votes
2 answers
What currency to use in unit tests?
I'm developing an application that relies heavily on Joda-Money, and have a number of unit tests that verify my business logic. One (admittedly minor) sticking point for me has been what sort of Money/BigMoney objects to test with; specifically,…

dimo414
- 47,227
- 18
- 148
- 244
6
votes
1 answer
Sum of Joda Money split into 2 columns with Spring Data JPA
I'm trying to use JODA money class with Jadira types to handle mapping to Hibernate 4.
It's working okay (except that I'm getting too many currency fields).
But I need to build an aggregate query to sum some totals.
This is the type…

Richard G
- 5,243
- 11
- 53
- 95
6
votes
2 answers
How to map Joda Money with org.jadira.usertype.moneyandcurrency.joda.PersistentMoneyAmountAndCurrency type in Hibernate?
Trying this:
@Type(type = "org.jadira.usertype.moneyandcurrency.joda.PersistentMoneyAmountAndCurrency")
private org.joda.money.Money price;
Getting this:
org.hibernate.MappingException: property mapping has wrong number of…

Alexander Mikhalchenko
- 620
- 1
- 5
- 20
5
votes
3 answers
ResultSet::getBigDecimal throws scale exception for joda-money
Attempting to create a Joda-Money Money object from a BigDecimal read from a MySQL database throws an error.
This code:
PreparedStatement p_stmt = ...;
ResultSet results = ...;
Money amount = Money.of(CurrencyUnit.USD,…

ryvantage
- 13,064
- 15
- 63
- 112
3
votes
1 answer
MoneyFormatter::parseMoney throws MoneyFormatException
Take this SSCCE (with Joda-Money library installed):
public static void main(String[] args) {
BigDecimal bd = new BigDecimal("100");
MoneyFormatter mf = new MoneyFormatterBuilder().appendLiteral("$…

ryvantage
- 13,064
- 15
- 63
- 112
2
votes
1 answer
Converting String to Money
I am having the below String
String money = "USD0.00"
Want to convert this into org.joda.money.Money
Do I need to split the currency unit and double value here and need to set it as separately in Money. Or Any library api is there to convert this?

Remo
- 534
- 7
- 26
2
votes
1 answer
How to format negative amounts with Joda Money?
I'd like to format negative amounts with minus sign before currency symbol, i. e:
Given input value: -123.45
I want the output to be: -$123.45.
Is there any way to acomplish it with Joda Money?
Here's what I tried:
Money money =…

Adamantium
- 118
- 7
2
votes
1 answer
How to store joda.money in mysql
I have a class which has attribute of datatype joda.money.
How can I map this attribute into mysql.
my class is:
@Table(name="products") public class Product(){ @Column(name="name")
String name; @Column(name="money") Money money; }
I am using…

user1183194
- 137
- 1
- 2
- 14
1
vote
0 answers
How to set the currency symbol to the correct locale position ($ 20 vs 20 $) - Joda money
I am using this bit of code to format my currencies (I am using joda money)
public static MoneyFormatter getDefaultLocaleFormatter() {
return new MoneyFormatterBuilder()
.appendAmountLocalized()
…

Avinta
- 678
- 1
- 9
- 26
1
vote
0 answers
different formatting for EURO in JODA and JAVA
The below code (which is in JODA) prints: €12,23
String formatAmount = new MoneyFormatterBuilder().
appendCurrencySymbolLocalized().
appendAmountLocalized().
toFormatter().
withLocale(new…

JasonBlacket
- 67
- 1
- 6
1
vote
2 answers
Get display name of javax.money.CurrencyUnit
I have an instance of javax.money.CurrencyUnit and I want to display what is it's name in a given locale (for example "US Dollars", "Euro", "Japenese Yen", etc). I've read all the documentation but the only thing I was able to find is how to format…

Petar Tahchiev
- 4,336
- 4
- 35
- 48
1
vote
1 answer
How to store currency in a single field per table for Joda Money & Jadira User Type
I'm using JodaMoney library and the Jadira User types to store monetary values. I want to be able to store a single currency per table, instead of needing so many fields.
Is there a way to map the currencies to the same field? This doesn't work…

Richard G
- 5,243
- 11
- 53
- 95
1
vote
2 answers
NumberFormat vs Joda money
I need to display currency amount with the symbol and format based on currency code. Currently, I'm using a default locale for each currency code since I don't have access to the exact locale along with the currency code and using…

luv-yzag
- 35
- 1
- 6
1
vote
1 answer
Using scala.BigDecimal with Joda-Money
I am trying to use a scala BigDecimal with Joda-Money. Passing the scala BigDecimal to Money.of() does not work because it is expecting a Java BigDecimal.
[error] C:\test.scala:82: overloaded method value of with alternatives:
[error] (x$1:…

Tom Haigh
- 57,217
- 21
- 114
- 142