KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
What I am trying to do is read a text file in the code and insert it into a table called employee1. And I am getting this error: Hibernate: insert into EMPLOYEE1 (NAME, SALARY, MANAGER, ID) values (?, ?, ?, ?) identifier of an instance of com.Employee altered from 1 to 2 Exception in thread "main" org.hibernate.HibernateException: identifier of an instance of com.Employee altered from 1 to 2 at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:51) at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:82) at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:190) at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:70) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:669) at roseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:98) Code of the Employee.java public class Employee { private int id; private String name; private double salary; private String manager; public int getId() { return id; } public void setId(int s) { id = s; } //***************************************************// public String getName() { return name; } public void setName(String s) { name = s; } //***************************************************// public double getSalary() { return salary; } public void setSalary(double s) { salary = s; } //***************************************************// public String getManager() { return manager; } public void setManag
Tags (comma-separated)
Save Edits
Cancel