Hibernate HQL issue expecting IDENT found "*"
The method createQuery
expects an HQL query string.
HQL is an object-oriented querying language.
HQL interprets SELECT R.*
as select the member field *
of the object R
.
But *
is not a member field of R
. Is it?..
To select all the member fields of R
use:
SELECT R
FROM offerOrderProjectRel R, offerOrder O, project P
WHERE P.id = R.project_id and O.id = R.offer_order_id
and O.type = 'ORDER' and (P.status = 'PENDING' or P.status ='PROTECTED')
you use SQL query, not hql query, so it should be
Query q = getSession().createSQLQuery(SELECT_OOPR_TO_SEND);
For people that received the "expecting IDENT found “*”" error when using org.springframework.data.jpa.repository.Query
and found this question I'll add that you can change the nativeQuery
flag to true
:
@Query(value = "SELECT * FROM table1", nativeQuery = true)
List<Object> myFindAll();