Pessoal,
quando esta hql roda fora da aplicação ela funciona, mas quando a aplicação executa ocorre erro de sintaxe:
Hibernate:from Customer c where c.city like '%York%' order by c.city
Dez 17, 2012 2:49:23 PM org.hibernate.util.JDBCExceptionReporter logExceptions
Advertência: SQL Error: -1, SQLState: 42X01
Dez 17, 2012 2:49:23 PM org.hibernate.util.JDBCExceptionReporter logExceptions
Grave: Erro de sintaxe: Encountered "from" at line 1, column 1.
org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2223)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.jav
private void executeHQLQuery(String hql) {
try {
String newHql = hql;
Session session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
Query q = session.createSQLQuery(newHql);
List<Customer> resultList = q.list(); // <----------------- ERRO AQUI !
displayResult(resultList);
session.getTransaction().commit();
} catch (HibernateException he) {
he.printStackTrace();
}
}
Alguém pode ajudar?
Obrigado.
