I am trying to use few postgres inbuild functions, sub query and join in a single query in JPA where the result set is different from the actual entity. I could achieve this