ERROR: column 'id' not found while using session.createNativeQuery() in hibernate 5.4.14
try (Session session = sessionFactory.openSession()) { var clients = session.createNativeQuery("select c.fullname, c.city from client c where c.id=:id") .addEntity("c", Client.class) .setParameter("id", id);
Caused by: java.sql.SQLException: Column 'id' not found.
public class Client implements java.io.Serializable { private Integer id; private Product product; private String fullname; private String business; private String address;
<class name="javafxapplication.pojo.Client" table="client" catalog="clientie" optimistic-lock="version"> <id name="id" type="java.lang.Integer"> <column name="id" /> <generator class="identity" /> </id>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)