[Hibernate] Problem with saveOrUpdate()
- by kunkanwan
Hi,
I've problem with Hibernate.
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 row INSERT INTO User VALUES ('Bill');
Main.java
User bill = new User(); bill.setName("Bill"); session.saveOrUpdate(bill);
This code always trying insert bill to database , rather than update when row about Bill exists in DB...
Could you help me ?
Thank you for advance.