CREATE TABLE IF NOT EXISTS posts(
postid SERIAL NOT NULL,
owner SERIAL NOT NULL,
title VARCHAR(100) UNIQUE NOT NULL,
message VARCHAR(500) NOT NULL,
continent VARCHAR(100) NOT NULL,
country VARCHAR(100) NOT NULL,
state VARCHAR(100) NOT NULL,
languages VARCHAR(100)[] NOT NULL,
properties varchar(100) ARRAY NOT NULL,
PRIMARY KEY (postid),
FOREIGN KEY (owner) REFERENCES users(userid) ON DELETE CASCADE
);
final Query query = em.createNativeQuery("SELECT postid FROM posts WHERE :properties <@ properties");
query.setParameter("properties", propAux);
I'm migrating my project to hibernate (I'm using the version 1.0.0.Final of javax.persistence.Query), and I can't seem to run that query. It says that <@
operator doesn't work with types bytea
and suggests to cast it. I tried casting it to text[]
, replacing :properties <@ properties
with cast(:properties as text[]) <@ cast(properities as text[])
but didn't work either.
Any suggestions?
PS: propAux
is an array of Strings.