openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From plins...@gmail.com
Subject Re: Custom data types
Date Mon, 03 Dec 2007 22:52:37 GMT
Hi,

I think ValueHandler will be the way to go. This will let you use the
new type as a field, as a member of a list, and as a key or value in a
map.

Additionally, you'll be able to use instances of the new type in queries.

There is a sample ValueHandler for Points that should map well to your needs.

-Patrick

On 12/2/07, Roy Smith <roy.smith@primetext.com> wrote:
> I've got a custom (PostgreSQL) data type
>
> *create* type couk_cleverthinking_gwappo_db_Money *as* (local_value
> *numeric*(11,2),mnemonic *char*(3));
>
> and a corresponding Class definition.
>
> public class Money extends PGobject implements SQLData, Serializable,
> Cloneable{
> public BigDecimal localValue;
> public String currencyMnemonic;
> .
> .
> etc
> .
> .
> }
>
>
> After a bit of effort I got this working in JDBC(the key being
> PGConnection.addType()).
>
> Please could somebody give me some pointers on how to go about incorporating
> this custom type/mapping into OpenJPA.
> Eg. is this a Value Handler or Class Strategy problem (or am I barking up
> the wrong tree altogether)?
>
>
> very best wishes
> Roy
>
>
>
>
>
>


-- 
Patrick Linskey
202 669 5907

Mime
View raw message