[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[eclipselink-users] Postgresql and UUID eclipselink 2.4.0
|
I have been trying to figure out how to get the native uuid type in
postgresql and eclipselink to work together. I have a simple
table for
testing:
CREATE TABLE elink
(
el_id uuid NOT NULL DEFAULT uuid_generate_v4(), -- elink id
el_name character varying(255), -- elink name
CONSTRAINT el_pkey PRIMARY KEY (el_id )
DEFERRABLE INITIALLY IMMEDIATE
)
WITH (
OIDS=FALSE
);
ALTER TABLE elink
OWNER TO emann;
COMMENT ON COLUMN elink.el_id IS 'elink id';
COMMENT ON COLUMN elink.el_name IS 'elink name';
And the annotation on the field for id is:
@Id
@Column(name="el_id")
@UuidGenerator(name="uuid")
@GeneratedValue(generator="uuid")
private UUID elId;
I have also tried the custom UUIDSequence mentioned on the
website,
however that did not work either. I get the following error
(this is the
UUIDSequence native to 2.4.0):
Exception [EclipseLink-3002] (Eclipse Persistence Services -
2.4.0.v20120608-r11652):
org.eclipse.persistence.exceptions.ConversionException
Exception Description: The object
[66FB2FFB-2735-4A8C-AFDE-19246C78CC16], of class [class
java.lang.String], from mapping
[org.eclipse.persistence.mappings.DirectToFieldMapping[elId-->ELINK.el_id]] with descriptor [RelationalDescriptor(model.Elink --> [DatabaseTable(ELINK)])], could not be converted to [class [B].
So i am really curious about what is the proper way to get this
to work
using uuid type in postgresql.
Any help is welcome, thanks in advance.