I created the entity patient with a column ID
which is the primary key of the table PATIENT
. While inserting a new Patient
object, I get the following exception:
WARN: SQL Error: -20001, SQLState: 23502
org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
The column "ID" cannot be null.
This is the code creating the Patient
object:
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();
Patient patient = new Patient(1L, null, "John", "Kennedy", 12, "USA", "Wall Street");
session.save(patient);
The value id of the Patient
object is 1.
I am using struts with Tomcat 6 and Derby 10.9.1.0 and Hibernate 4.
Any help