16
I have a class User
class User {
int id;
String name;
}
where id is native generator in User.hbm.xml and name is primary-key in DB.
In my database I saved some information about Users.
Than I want to connect with this information about User.
For example in my DB I have a row INSERT INTO User VALUES ('Bill');
Main.java
User bill = new User();
bill.setName("Bill");
session.saveOrUpdate(bill);
This code always tries to insert a new Bill row into the table rather than update the existing Bill row.