Yes, I just discovered that myself - I was worried because I see a lot of
TradeCurrency.USD come out in logs and in JSPs where I guess toString() is used.
I figure it's workable this way, although I think custom type converters for
Java to SQL has got to be near if not at the top of my list of JPA improvements.
Tedman Leung on 25/04/08 15:24, wrote:
when I use enums it just saves the instance name i.e. USD not
TradeCurrency.USD I believe it stores the enum.getName() call.
From googling and a quick scan of the mailing list archives, it looks as if
I can't map java.util.Currency directly to a database column using pure JPA.
Unless anyone can tell me I'm wrong, I'm thinking of doing it with my own
enum of the currencies that my app uses and map it with
<enumerated>
Then the question becomes: what would be more future-compatible - ORDINAL
or STRING?
I assume STRING because java.util.Currency has no ordinal, but if I use
STRING, won't JPA save the String TradedCurrency.USD or TradedCurrency.EUR
instead of just USD or EUR?