Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用Hibernate查找数据,但它会发出警报;结果集关闭后不允许操作";_Java_Mysql_Hibernate - Fatal编程技术网

Java 使用Hibernate查找数据,但它会发出警报;结果集关闭后不允许操作";

Java 使用Hibernate查找数据,但它会发出警报;结果集关闭后不允许操作";,java,mysql,hibernate,Java,Mysql,Hibernate,这是一个例外: org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL ... Caused by: java.sql.SQLException: Operation not allowed after ResultSet closed 代码如下: 只有函数“getByReportDat

这是一个例外:

org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL ...
Caused by: java.sql.SQLException: Operation not allowed after ResultSet closed
代码如下: 只有函数“getByReportDate”是我自己写的,其他的都是hibernate生成的。我用同样的方法操作了另一个java模型,它成功了。但是到了一个,它失败了

//DAO
public static final String REPTIME = "reportTime";

public List getByReportDate(Object recOrgName) {
    return findByProperty(REPTIME, recOrgName);
}

public List findByProperty(String propertyName, Object value) {
  log.debug("finding TblEntPaytaxList instance with property: " + propertyName
        + ", value: " + value);
  try {
     String queryString = "from TblEntPaytaxList as model where model." 
                            + propertyName + "= ?";
     return getHibernateTemplate().find(queryString, value);
  } catch (RuntimeException re) {
     log.error("find by property name failed", re);
     throw re;
  }
}


//Object
public class TblEntPaytaxList  implements java.io.Serializable {

 ...
 private String econType;
 private Date reportTime;
 private double money;
 ...

EntityManager已关闭会话。打开会话。那么在哪里打开会话?使用hibernate打开会话。您需要仔细阅读以下内容:公共列表getByReportDate(Object recOrgName){session session=this.getSession();return findByProperty(REPTIME,recOrgName);}