Looks like you are having fun learning too! Here's what I did...
I did a query.list() to retrieve a list of all objects that satisfy the query, then call session.delete(Object) on each of them. If you're not familiar with query.list, you can also use either session.find() for a full list of objects all in memory at the same time, or session.iterate() to bring them back one by one... at the expense of executing SQL for each row.
Code:
try {
session = hSessFact.openSession();
}
catch(HibernateException e) {
logger.error("Could not create Hibernate Session.", e);
throw e;
}
try {
Query query = session.getNamedQuery("ConxxxxRequest_by_job_id");
query.setString("JOBID", jobName);
tx = session.beginTransaction();
jobList = query.list();
ListIterator li = jobList.listIterator();
while(li.hasNext()) {
ConxxxxRequest request = (ConxxxxRequest)li.next();
session.delete(request);
}
tx.commit();
}
catch(Exception e) {
if(tx != null) {
tx.rollback();
}
logger.error("Hibernate processing error.", e);
}
finally {
session.close();
}