Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Is posible execute a update like this:
Code:
public static void expiraPreReserva() throws HibernateException, ParseException {
Session sess = SessionFactory.currentSession();
Transaction tr = sess.beginTransaction();
Query q = sess.createQuery( "UPDATE TPreReserva SET status='E' where dataFpr < ?" );
q.setDate( 0, EuroUtil.getDataAtual() );
q.list();
tr.commit();
SessionFactory.closeSession();
}
but this throws the exception:
net.sf.hibernate.QueryException: query must begin with SELECT or FROM: UPDATE [UPDATE TPreReserva SET status='E' where dataFpr < ?]
Thanks JP