hibernate + postgres + UUID + BYTEA


#1

We are getting the following error when trying to insert data into a table containing UUID as foreign key.

Caused by: org.postgresql.util.PSQLException: ERROR: column “companyid” is of type uuid but expression is of type bytea Hint: You will need to rewrite or cast the expression. Position: 57

CREATE TABLE public.car ( uuid uuid NOT NULL, companyid uuid, model character varying(255) COLLATE pg_catalog.“default”, price character varying(255) COLLATE pg_catalog.“default”, CONSTRAINT car_pkey PRIMARY KEY (uuid) CONSTRAINT companyid FOREIGN KEY (uuid) REFERENCES public.company (id) )

CREATE TABLE public.company ( id uuid NOT NULL, company character varying(255) COLLATE pg_catalog.“default”, CONSTRAINT company_pkey PRIMARY KEY (id) )

Technology Used:Java7, Hibernate 4.3.11, Postgres 9.6.

Please note we do not want to store companyid as bytea in the CAR table, as this would mean lot of changes in the code.


#2

You need to replicate the issue with this test case template, and send it as a Pull Request so we can investigate it.