hibernate请求的问题(Oracle)
我的请求有问题,我不明白为什么会出现此错误
未在预期位置找到关键字
我的 dao
public List getAllDeclaration(String anneeEnCours) throws FiscaliteException {
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("getAllDeclaration");
}
// Creation de la connexion
Session session = 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;
}
控制台中出现错误
2010-08-19 15:01:47,962 错误 util.JDBCExceptionReporter (JDBCExceptionReporter.java:72) - ORA-00923: 未找到 FROM 关键字 预期的地方
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 session = 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您使用它进行查询时会发生什么(添加“as”关键字):
What happens when you use this for the query (adding the "as" keyword):