<%
org.hibernate.Session s = HibernateSessionFactory.currentSession();
String hql = "from Xmb where dl=:dl order by xh asc";
Lbb dl = (Lbb)s.get(Lbb.class, new Integer(1));
List list = s.createQuery(hql).setEntity("dl", dl).list();
Xmb xmb = null;
for (Iterator its = list.iterator(); its.hasNext(); ) {
xmb = (Xmb)(Object)its.next();
。。(读数据)
}
HibernateSessionFactory.closeSession();
xmb = null;
list = null;
hql = null;
%>
报错:
org.hibernate.exception.SQLGrammarException: could not execute query
=========================Lbb dl = (Lbb)s.get(Lbb.class, new Integer(1));是没有问题的,试验过,成功得到持久化类
不知出了什么问题?
org.hibernate.Session s = HibernateSessionFactory.currentSession();
String hql = "from Xmb where dl=:dl order by xh asc";
Lbb dl = (Lbb)s.get(Lbb.class, new Integer(1));
List list = s.createQuery(hql).setEntity("dl", dl).list();
Xmb xmb = null;
for (Iterator its = list.iterator(); its.hasNext(); ) {
xmb = (Xmb)(Object)its.next();
。。(读数据)
}
HibernateSessionFactory.closeSession();
xmb = null;
list = null;
hql = null;
%>
报错:
org.hibernate.exception.SQLGrammarException: could not execute query
=========================Lbb dl = (Lbb)s.get(Lbb.class, new Integer(1));是没有问题的,试验过,成功得到持久化类
不知出了什么问题?
——不好意思,怎么看控制台?服务在后台,没有开控制台窗口呀?
控制台输出的SQL语句信息如下:
Hibernate: select xmb0_.xh as xh3_, xmb0_.xmm as xmm3_, xmb0_.lbh as lbh3_, xmb0_.dlh as dlh3_, xmb0_.lx as lx3_, xmb0_.yxhj as yxhj3_, xmb0_.yy as yy3_, xmb0_.dx as dx3_, xmb0_.pj as pj3_, xmb0_.djsj as djsj3_, xmb0_.xgsj as xgsj3_, xmb0_.author as author3_, xmb0_.authorurl as authorurl3_, xmb0_.tp as tp3_, xmb0_.passwd as passwd3_, xmb0_.jj as jj3_, xmb0_.lr as lr3_, xmb0_.tj as tj3_, xmb0_.sc as sc3_ from softdown.xmb xmb0_ where dl=? order by xmb0_.xh asc
看上去没什么不对的呀?