Hi Robert,
This sounds like a good exercise...  As you have found out, OpenJPA does
not currently provide direct mappings for the uuid type in any database.
We support the String version of UUID generation [1], but not the UUID type
found in postgres or other databases.  This should not be a difficult
task.  Although you are interested in Postgres support, I would encourage
you to look at allowing this support to be extended to other databases that
might support a UUID type.

First off, I would reference this documentation [2].  Although brief, this
explains the type of field mapping that you are probably interested in.  I
would expect that a simple ValueHandler implementation would be sufficient,
but depending on the necessary interactions with the database a
FieldStrategy might be necessary.  I'd start with a ValueHandler though.

As the documentation suggests, I would first take a look at the
ValueHandlers we already have in place, such as the EnumValueHandler.
There are several ValueHandler examples in that
org.apache.openjpa.jdbc.meta.strats package.

We have quite an extensive junit bucket as well, so be sure to reference
the testcases relating to ValueHandlers.  Junits would be appreciated
(expected) with any type of proposed solution.

Thanks!  And, Good Luck!
Kevin

[1]
http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#jpa_overview_meta_gen
[2]
http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#ref_guide_mapping_custom_field


On Wed, Jun 26, 2013 at 9:23 AM, Robert Velter <rob...@velter.de> wrote:

> Hello,
>
> i'm currently using glassfish3 (eclipselink) with postgresql. There i
> have a converter for mapping java.util.UUID to the native database type
> "uuid" of postgres (including a converter initializer which
> automatically installs it on every session).
>
> Now i want to switch to tomee and look for documentation how to do this
> in openjpa. I already read the chapter about custom mappings in the
> reference guide, but miss somehow the "big picture"...
>
> Cheers, Robert
>
> --
> Robert Velter <rob...@velter.de>
>
>

Reply via email to