Issue with TypedQuery in Service where querying against column of type uuid

Hi - I am new to Cuba Platform, so hopefully this is a silly mistake on my part.

I am trying to run the following TypedQuery (as a test) from a service bean
"select g from sec$Group g where g.parent_id = ‘0fa2b1a5-1d68-4d69-9fbd-dff348347f93’"

Unfortunately, this throws the following error…

java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Problem compiling [select g from sec$Group g where g.parent_id = ‘0fa2b1a5-1d68-4d69-9fbd-dff348347f93’].
[32, 43] The state field path ‘g.parent_id’ cannot be resolved to a valid type.

I can run this (similar) query in psql with no problems though
select g.parent_id from sec_group g where g.parent_id = ‘0fa2b1a5-1d68-4d69-9fbd-dff348347f93’;

Can you please tell me where I am going wrong - I have tried many iterations of the query - both with and without named or positional parameters, passing in both String and UUID values

Many thanks for any help

Hi Gary,

When you write JPQL query you should use names of properties instead for columns names. So, you should put g.parent.id for the where clause and not the g.parent_id DB field. The following statement should work:


select g from sec$Group g where g.parent.id = "0fa2b1a5-1d68-4d69-9fbd-dff348347f93"

Regards,
Aleksey

Thanks Aleksey - that worked perfectly !