当我点击相同的网址超过 4 次时,没有得到 Dao 类的回应



我在春季休眠项目的网络浏览器上点击了一些 Url 链接网址工作正常,直到 4 次连续命中,但当我第 5 次点击相同的网址时

没有响应它只显示处理......并且它不显示任何异常

这是我的方法的代码,由控制器类调用

 public List<Object> getListForSingleColumn(String query){
     List<Object> ls_ob = new ArrayList<Object>();
     try {

     Session session = this.sessionFactory.openSession();
        /*Session session = this.sessionFactory.getCurrentSession();*/
         System.out.println("step--1 in getListForSingleColumn");
            Query q = session.createQuery(query);
            System.out.println("step--2 in getListForSingleColumn");
            ls_ob  = q.list();
            System.out.println("step--3 in getListForSingleColumn");
     } catch (Exception e) {
            System.out.println("Exception in getListForSingleColumn "+e);
        }
     System.out.println("returning in getListForSingleColumn");
            return ls_ob;
        }

当我第 5 次点击相同的 URL 时,我得到的输出如下所示:

step--1 in getListForSingleColumn
step--2 in getListForSingleColumn
Hibernate: select distinct wallpaper0_.cat as col_0_0_ from Wallpaper_s wallpaper0_
till the 4th time its working fine

我该如何分析这个问题...我没有太多的知识 冬眠和春天?

显然,您不会关闭会话。因此,由于内存不足,您的应用程序会停止运行。

如果你想学习Hibernate,从一个简单的控制台应用程序开始,没有DAO和Spring。

你没有注意到OutOfMemoryError,因为它是你抓到的Error而不是Exception。你应该以这种方式输出一个异常

e.printStackTrace();

最有效的方法是使用记录器

LOG.error("Exception in getListForSingleColumn", e);

相关内容

最新更新