Olá,
o que pode ser que está dando erro…no mysql faço esse comando e apresenta certo o resultado…
public Long[] getCountAluno() {
Long[] retorno = null;
String hql = "";
try {
hql ="select count(distinct(nm_aluno)) from resposta_aluno" ;
Query query = (Query) this.session.createSQLQuery(hql.toString()) ;
retorno = (Long[]) query.uniqueResult();
} catch(Exception e) {
System.out.println( "Erro "+ e);
}
return retorno;
}
Erro org.hibernate.HibernateException: createSQLQuery is not valid without active transaction