You have more choices here.
- You can make two fields representing Joda's
Money
.BigDecimal
for amount andString
for currency. Then create transient synthetic fieldMoney
and create it in getter (see example below). - You can implement your own
UserType
and provide serialization/deserialization by your own. See javadoc UserType and documenatation Custom types using org.hibernate.usertype.UserType. Take a look at this implementation ofCompositeUserType
. You can include Jadira Usertypes project which provides Joda
Money
support for Hibernate (I've never tryied anyway)@Entity @Table(name = "products") public class Product { @Basic @Column private BigDecimal amount; @Basic @Column private String currency; private transient Money money; public Money getMoney() { if (money == null) { money = Money.of(CurrencyUnit.of(currency), amount); } return money; } }