Here is the detailed description of the problem.
I am trying to fetch a record lets say (primary key id=10).
Then I am updating it, say changing some fields.
Now I am saving it (entityManager.persist(Object)).
So in my console all I am getting is a update statement but I want it to be inserted as a new row. What I need to change?
I guess its because of the id. Since the object has id=10 ,hibernate is running an update statement. I tried to make the id as 0 before persisting but got exception.
Please help me. I am not pasting any code as I feel it is not needed in this case.
thnks for the quick reply
i m using this annotation
private int id;
the id is int so I can not make it as null and I already tried 0 but it didn't work. I searched in internet and I understood that if we try to modify a bean and then again save it, its gets updated in hibernate by default.
But in this case, i want to modify and then insert.