Kunal Batra Kunal Batra - 2 years ago 58
Java Question

Getting no response from Dao class when i hit tha same url more than 4th times

I am hitting some Url link on web browser of my spring hibernate project
url working fine till the 4 continuosly hits but when i hitsame url 5th time

its not responding its showing only processing.. and its not showing any exception

here is the code of my method that get called by the controller class

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;

when i hit the same url 5th time then the output i got is like below:

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

how can i analysis this problem... i dnt have too much knowledge of
hibernate and spring?

Answer Source

Obviously, you don't close a session. So your application stall, because of out of memory.

If you want to learn Hibernate, begin from a simple console application without DAO and Spring.

You don't notice OutOfMemoryError, because of it is an Error not an Exception that you catch. And you should output an exception this way


The most valid way is to use a logger

LOG.error("Exception in getListForSingleColumn", e);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download