Problem with hibernate request (Oracle)
i have a problem with my request, i don't understand why i have this error
from keyword not found where expected
my dao
public List getAllDeclaration(String anneeEnCours) throws FiscaliteException {
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("getAllDeclaration");
}
// Creation de la connexion
Session ses开发者_JS百科sion = getHibernateTemplate().getSessionFactory().getCurrentSession();
List allDeclaration = null;
try{
String query = "FROM CalculIDF calculIDF " +
"WHERE calculIDF.idCalculIDF.annee=:annee ";
Query q = null;
q = session.createQuery(query);
q.setString("annee", anneeEnCours);
allDeclaration = q.list();
session.flush();
}
catch (Exception e)
{
System.out.println(e.getMessage()+" "+e.getStackTrace());
}
return allDeclaration;
}
Error in the console
2010-08-19 15:01:47,962 ERROR util.JDBCExceptionReporter (JDBCExceptionReporter.java:72) - ORA-00923: FROM keyword not found where expected
What happens when you use this for the query (adding the "as" keyword):
String query = "FROM CalculIDF as calculIDF " +
"WHERE calculIDF.idCalculIDF.annee=:annee ";
精彩评论