Home » Java » i am trying to select 2 columns from db through jpa but getting error saying “java.sql.SQLException: No such column :id”

i am trying to select 2 columns from db through jpa but getting error saying “java.sql.SQLException: No such column :id”

Posted by: admin September 26, 2018 Leave a comment

Questions:

i am trying to display 2 columns data from db instead of * and i have used bellow query but it is not working.

@Query(value = "Select empid,empname from employee group by empid", nativeQuery = true)
List<EmpDetailsDB> findempfidempname();

please guide me if i am wrong.

detailed error in response

{
    "timestamp": 1531975044038,
    "status": 500,
    "error": "Internal Server Error",
    "exception": "org.springframework.orm.jpa.JpaSystemException",
    "message": "could not execute query; nested exception is org.hibernate.exception.GenericJDBCException: could not execute query",

}
Answers: