Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate 3.0
public static void deleteOldestresource(int user_id)
{
Date min_date = null;
List list = new ArrayList();
Session session;
Query query1, query2;
try
{
HibernateUtil.beginTransaction();
session = HibernateUtil.getSession();
query1 = session.createQuery(HQL_SELECT_OLDEST_RESOURCE);
query1.setParameter("user_id", Integer.toString(user_id), Hibernate.STRING);
list = query1.list();
min_date = (Date)list.get(0);
query2 = session.createQuery(HQL_DELETE_OLDEST_RESOURCE);
query2.setParameter("user_id", Integer.toString(user_id), Hibernate.STRING);
query2.setParameter("min_date", min_date, Hibernate.DATE);
System.out.println("BEFORE QUERY 2 ="+query2);
query2.list();
System.out.println("AFTER QUERY 2 ="+query2);
HibernateUtil.commitTransaction();
HibernateUtil.closeSession();
}
catch(HibernateException he)
{
System.out.println("Hibernate Exception"+ he);
}
}
6150 [http-8080-Processor25] ERROR hql.parser - *** ERROR: <AST>:0:0: unexpected end of subtree
6158 [http-8080-Processor25] ERROR hql.parser - *** ERROR: <AST>:0:0: unexpected end of subtree
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt: