I'm using QueryDSL SQL with PostgresTemplates
and I'm trying to put UUID parameter into query, but when I'm executing this query:
UUID uuid = UUID.randomUUID();
QOrganization org = QOrganization.organization;
long count = new SQLQuery(connection, configuration)
.from(org)
.where(org.id.eq(uuid))
.count();
Database complains:
org.postgresql.util.PSQLException: there is no operator does not exist: uuid = character varying
How can I explicitly cast my UUID parameter?
Querydsl SQL maps currently UUID types to PreparedStatements via setString. It looks like Postgres supports setting UUIDs directly via setObject, so some tuning of UUID support in Querydsl SQL seems to be needed.