I use in my project Hibernate. And have error when the server start:
org.hibernate.PersistentObjectException: detached entity passed to persist
Following "autorization" code:
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@Column(name = "login", unique = true, updatable = false)
private String name;
//Important to Hibernate!
@SuppressWarnings("MySQLConfig")
public UsersDataSet() {
}
@SuppressWarnings("MySQLConfig")
public UsersDataSet(long id, String name) {
this.setId(id);
this.setName(name);
}
public UsersDataSet(String name) {
this.setId(-1);
this.setName(name);
}
Please, explain me, where am I wrong?