So I have a persistent object , that can be sent over a network. It can bounce back without changes and need to be saved as a separate entity.
When I try to save I get such exception. Exception in thread "AWT-EventQueue-0" org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session:
@Entity
class Foo
{
@Id @GeneratedValue
int id;
@Column
String name
@OneToMany
List<Foo2> = new ArrayList<>();
}