WARN : org.hibernate.engine.jdbc.spi.SqlExceptionHelper - SQL Error: 17011, SQLState: 99999 ERROR: org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Exhausted Resultset org.hibernate.exception.GenericJDBCException: could not execute query at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126) at org.hibernate.loader.Loader.doList(Loader.java:2556) at org.hibernate.loader.Loader.doList(Loader.java:2539) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2369) at org.hibernate.loader.Loader.list(Loader.java:2364) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:496) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:387) at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:231) at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1264) at org.hibernate.internal.QueryImpl.list(QueryImpl.java:103) at com.airtel.siva.config.ApplicationConfig.findAll(ApplicationConfig.java:84) at com.airtel.siva.Controllers.TaskController.newtasks(TaskController.java:154) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) atWARN :

here is the code from where i am getting my session and creating the query for fetchin the data from my oracle database:-

public static <T> Session getSession(Class<T> clazz) {

        try {   
            Configuration cfg = new Configuration().configure();    
            StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder()
                    .applySettings(cfg.getProperties());    
            SessionFactory sf = cfg.buildSessionFactory(builder.build());    
            Session session = sf.openSession();    
            session = getSession();
            session.beginTransaction();
            Query query = session.createQuery("from " + clazz.getName());                            
            List<T> listData = query.list();       

        } catch (Exception e) {
            logger.info("Error in creating session with Database", e);
        }    
finally {
            if (session != null && session.isOpen()) {
                session.close();
            }    
        return listDAta;
        }
1

There are 1 best solutions below

4
Alien On

As you are trying to access Oracle database you will not able to access data until the transaction has been successful and to complete the transaction you have to fire a commit. Because Oracle database is not on auto commit mode by default.

session.getTransaction().commit();