
Originally Posted by
ElPapa
I'm using spring and hibernate and I need to do a simple update...
I must first correct biot023: it is possible to issue updates in HQL - since Hibernate 3.0 at least.
Back to the actual question - you'll have to write a "beast" like:
Code:
getHibernateTemplate().execute(new HibernateCallback() {
public Object doInHibernate(Session session) throws HibernateException, SQLException {
SQLQuery query = session
.createSQLQuery("UPDATE ASYNCDATA SET MESSAGESTATUS='PROCESSING', BROADCASTSTATUS='', CONVERSIONREQUIRED='TRUE' "
+ "where SSN='000552111'");
query.executeUpdate();
return null;
};
});
Note that variations on this are possible (see the Hibernate documentation on Query and SQLQuery) and that what I wrote above may not work as is - but this is the general intention.
Not knowing enough about your POJOs I can't really offer you a sensible version of this using HQL and Query.
If you have a concrete problem, simply post again...
Erik