public boolean modifyDuration(long id, int dur) {
final long contentId = id;
final Integer duration= dur;
final String hqlUpdate = "update Content set duration = :duration where CONTENTID_PK = :id";
Integer result = (Integer)this.execute(new HibernateCallback() {
public Object doInHibernate(Session session) throws HibernateException,
SQLException {
return session.createQuery(hqlUpdate)
.setInteger( "duration", duration)
.setLong( "id", contentId )
.executeUpdate();
}
});
boolean success = result == 1 ? true : false;
return success;
}