Hi, i have been trying to get this working all day but i cant figure it out. I really just need a simple example so i can fix this program at work.
i have no problem inserting new records using hibernate, but editing one keeps throwing errors.
here a hypothetical situation :
- lets assume there is already a working session
-there is a table called Person
-this table contains 2 fields, ID (which is primary key) and name
- lets say i want to update the record where ID = 100
how should i do that? i am trying the following, but it just wont work
String query= "from Person where ID = 100";
Person p1 = (Person) sessionFactory.getCurrentSession().createQuery(query);
String name="Why Wont It Work" ;
p1.setName(name);
sessionFactory.getCurrentSession().saveOrUpdate(best);
am i making mistakes here? or are these lines correct and should i look at other parts of my code