Hello, i'm trying to create a criteria to execute a SQL query that uses the 'to_char' function from postgres. I also need to make a cast from string to integer in the query.
I just can't find a way to do it using Criteria.
Code:
SELECT documento.id as id_documento,alunopre.id as id_alunoPre FROM alunopre
INNER JOIN nucleo on alunopre.nucleo_id = nucleo.id
INNER JOIN projeto on nucleo.projeto_id = projeto.id
INNER JOIN projetodocumento ON projetodocumento.projeto_id=projeto.id
INNER JOIN documento ON projetodocumento.documento_id = documento.id
except
(
SELECT documento.id as id_documento,alunopre.id as id_alunoPre FROM alunopre
INNER JOIN alunopreprojetodocumento ON alunopreprojetodocumento.alunopre_id = alunopre.id
INNER JOIN projetodocumento ON alunopreprojetodocumento.projetodocumento_id = projetodocumento.id
INNER JOIN documento ON projetodocumento.documento_id = documento.id
where CAST(to_char(NOW(), 'YYYY') AS integer) < (CAST(to_char((alunopreprojetodocumento.dataentrega), 'YYYY') AS integer)+projetodocumento.prazovalidade)
) order by id_documento
Any ideas about how to do it?
Sorry for my english, I think i must train it a little more.
If you have doubts about what i wrote, plz let me know.
Thanks in advance.