I want to write a JPA query from a native query. The Native query is as follows:
select alias.fname
from (select name, fname, lname from student) alias
where student_id='1';
I am unable to create a JPA query from this, any help is appreciated. Thanks.
Looking at the JPQL docs and Hibernate docs, subquery in the WHERE
clause is not supported. You are left with the options of either:
select fname from student where student_id='1'
(which I assume isn't your real query).JOIN
s if possible, or