I'm working with hibnernate and I've a piece of code like:
Criteria criteria = getCurrentSession().createCriteria(objectClass);
criteria.add(Restrictions.isNull("myFields"));
System.out.println("SQL: " + criteria.getSQL()); <-- How can I do this?
return criteria.list();
I'd like to print the SQL (or HQL) to the console, for debugging, but I can't find any method to get this kind of information.
I've already seen many answers on stackoverflow like this and this but those are old questions and I dosen't find any useful answer.
Can anyone help me? Thanks