I have a DB table with id as primary key.
In the object I have define the colomn getter using @Id
When the user creates a new row it does assign it a new Id.
but it also assign a new id to the old object.
thus,
when I iterate a list using
for(){
session.save(myO);
}
I get new rows in the db for the new elements but also new rows for the old ekements.
Any assistance?
Thanks.
The javadoc says:
You should call
saveon an existing, detached instance.saveis to persist a new entity. UsesaveOrUpdateormerge.