Hi
I am trying to update a table in SQL Server database using Hibernate and Struts.
I used the statement :
Session session = null; SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); session = sessionFactory.openSession(); int in = session.createQuery("update Chem c set c.min= :min where c.element =:element").setString("min", form.getMin()).setString("element", form.getElement()).executeUpdate(); session.flush(); if(in!=0) grade="success"; session.close();
I have a JSP page with text fields for element and min with properties element and min respectively. I already have values for these fields in the database which are shown when I first load the page.
When I am trying to change the values, the following problems occur:
a) the values are not getting updated in the database.
b) When I try to see the updated results in the JSP page, it just gets stuck when loading the page and it doesnt show me the page.
I have flushed the session and i have closed the session. I cant understand why it is taking so much time to load and why it is not updating values in the database.
Can someone help me out?
Thanks
Neeti
|