After changing the @id
of a Entity from
@Id
private int getId(){
return this.id;
}
to
@Id
private String getLogin(){
return this.login;
}
I get the error:
a different object with the same identifier
value was already associated with the session
In the webapplication isn't changed anything. A read the entity and then change some fields in a form and than after submit I tried to save or update the Entity. With the int
as @Id
there was no problem but now with the String
as @Id
I get the above error by update or save the Entity:
@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW)
public void saveOrUpdate(User u) {
getHibernateTemplate().saveOrUpdate(u);
}
What could be the problem?