0

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;
        }
yash
  • 51
  • 1
  • 9

1 Answers1

0

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();
Alien
  • 15,141
  • 6
  • 37
  • 57
  • after added .commit i am getting this exception : WARN : org.hibernate.engine.jdbc.spi.SqlExceptionHelper - SQL Error: 17010, SQLState: 08003 ERROR: org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Closed Resultset: wasNull org.hibernate.exception.JDBCConnectionException: could not execute query at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConvers – yash Mar 27 '20 at 05:58
  • That is totally different exception which you need to resolve either post a new question or Refer this https://stackoverflow.com/q/935511/6572971 – Alien Mar 27 '20 at 11:34
  • the link which you provide its related to JDBC and i am facing this problem with hibernate – yash Apr 02 '20 at 07:48
  • Please raise a new question. – Alien Apr 03 '20 at 17:04