I am pretty new to hibernate.
I am trying to run a simple aggregate function and I keep receiving the following error
No data type for node: org.hibernate.hql.ast.AggregateNode
\-[AGGREGATE] AggregateNode: 'max'
Here is the code
Code:
public static void resetIdField(SessionFactory factory){
Session session = null;
try{
session = factory.openSession();
String sql_query = "select max(ct.id) from CONTR00001 ct";
Query query = session.createQuery(sql_query);
System.out.println(sql_query);
for(Iterator it=query.iterate();it.hasNext();){
Object[] row = (Object[]) it.next();
System.out.print(row[0]);
System.out.print("\t\t"+row[1]);
System.out.print("\t"+row[2]);
System.out.println();
}
session.close();
}
catch(Exception e ){
System.out.println(e.getMessage());
}
}
Any help would be greatly appriciated