1

I'm using native query as below in spring boot with postgres and hibernate.

@Query(value = "SELECT json_data from xxxschema.roles where role_id =?1", nativeQuery = true) Role getRolePrivilegesByRoleId(int id);

I'm getting following errors not sure why ?

org.postgresql.util.PSQLException: The column name role_id was not found in this ResultSet. at org.postgresql.jdbc.PgResultSet.findColumn(PgResultSet.java:2748) ~[postgresql-42.2.16.jar:42.2.16]

1 Answer 1

1

You are returning Role but do not return all columns from the query mapped in the Role entity.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.