Hi all, i have the following method that belongs to a Spring application
Code:
public void increasePrice(Product prod, int pct) {
logger.info("Increasing price by " + pct + "%");
SqlUpdate su = new SqlUpdate(ds, "update products set price = price * (100 + ?) / 100 where id = ?");
su.declareParameter(new SqlParameter("increase", Types.INTEGER));
su.declareParameter(new SqlParameter("ID", Types.INTEGER));
su.compile();
Object[] oa = new Object[2];
oa[0] = new Integer(pct);
oa[1] = new Integer(prod.getId());
int count = su.update(oa);
logger.info("Rows affected: " + count);
}
The implementation is based in Spring JDBC, but i would like to change to HQL. How can i get this?
I am reading Hibernate API. HibernateTemplate contains utility methods to query against a database. I am trying with save(Object o) and saveOrUpdate(Object o) but it doesn't run.
Any help will be wellcome.
Thanks in advance