日期:2014-05-19  浏览次数:21039 次

InvalidDataAccessResourceUsageException:could not execute query,求助,谢谢。
ssh2做的项目
PubUser的映射文件为:
<hibernate-mapping>
<class name="com.simple.systemset.vo.PubUser" table="PUB_USER"
schema="SIMPLE">
<id name="userId" type="java.lang.Long">
<column name="USER_ID" precision="4" scale="0" />
<generator class="native"/>
</id>
<property name="name" type="java.lang.String">
<column name="NAME" length="50" not-null="true" />
</property>
<property name="opcode" type="java.lang.String">
<column name="OPCODE" length="50" not-null="true" />
</property>
<property name="pswd" type="java.lang.String">
<column name="PSWD" length="50" not-null="true" />
</property>

<many-to-one name="pubDep" column="dep_id" unique="true" class="com.simple.systemset.vo.PubDep"/>

<many-to-one name="pubUserGroup" column="group_id" unique="true" class="com.simple.systemset.vo.PubUserGroup"/>

<property name="createTime" type="java.util.Date">
<column name="CREATE_TIME" length="7" not-null="true" />
</property>
<property name="createUser" type="java.lang.Long">
<column name="CREATE_USER" precision="4" scale="0"
not-null="true" />
</property>
</class>
</hibernate-mapping>
现在一执行这个方法就报错:
public List findPageByQuery(int intCurPage, int intPageRows) {
  try {
final int a = (intCurPage - 1) * intPageRows;
final int b = intPageRows;
List list = getHibernateTemplate().executeFind(
new HibernateCallback() {
public Object doInHibernate(Session session)
throws HibernateException, SQLException {
Query query = session.createQuery("from PubUser");
query.setFirstResult(a);
query.setMaxResults(b);
List list = query.list();
return list;
}
});
return list;

  } catch (RuntimeException re) {
throw re;
  }
错误信息为org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute query; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query 
在网上查了应该是和关联有关,去了关联好用。不知道怎样解决,谁遇到过这种问题帮帮忙,谢谢了。



------解决方案--------------------
看这有点眼熟………………