java.sql.SQLException: Was expecting a result set

Hibernate JIRA | Alexey Filippov | 1 decade ago
  1. 0

    I've found one problem with EntityPersister: when it tries to insert entity via jTDS drivers, there is exception thrown: 127174 [DEBUG] HibernateSession - insert(Log[@DOMORESPORTS/Club/Groups-Service Granted]) Hibernate: insert into span.span.Logs (Username, ClientID, [Date], [Time], Status, Core, Action1, Action2, Action3) values (?, ?, ?, ?, ?, ?, ?, ?, ?) select SCOPE_IDENTITY() 127391 [WARN ] JDBCExceptionReporter - SQL Error: 0, SQLState: null 127392 [ERROR] JDBCExceptionReporter - Was expecting a result set 127724 [WARN ] JDBCExceptionReporter - SQL Error: 0, SQLState: null 127968 [ERROR] JDBCExceptionReporter - Was expecting a result set 127983 [ERROR] JDBCExceptionReporter - could not insert: [com.dataart.newham.util.LogRecord] java.sql.SQLException: Was expecting a result set at net.sourceforge.jtds.jdbc.PreparedStatement_base.executeQuery(PreparedStatement_base.java:203) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:205) at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:508) at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:432) The problem is in executeQuery() method: you should not use this method on complex statements, because they produce more than one result. I've fixed it, diff file for EntityPersister attached. There's workaround for this problem: it is enough to override public String appendIdentitySelectToInsert(String insertSQL) and return null. But I hope my solution is a bit more usable one. 508c494,497 < return getGeneratedIdentity( object, session, insertSelect.executeQuery() ); --- > insertSelect.execute(); > while (insertSelect.getResultSet() == null) > insertSelect.getMoreResults(); > return getGeneratedIdentity( object, session, insertSelect.getResultSet() ); 519d507 <

    Hibernate JIRA | 1 decade ago | Alexey Filippov
    java.sql.SQLException: Was expecting a result set
  2. 0

    I've found one problem with EntityPersister: when it tries to insert entity via jTDS drivers, there is exception thrown: 127174 [DEBUG] HibernateSession - insert(Log[@DOMORESPORTS/Club/Groups-Service Granted]) Hibernate: insert into span.span.Logs (Username, ClientID, [Date], [Time], Status, Core, Action1, Action2, Action3) values (?, ?, ?, ?, ?, ?, ?, ?, ?) select SCOPE_IDENTITY() 127391 [WARN ] JDBCExceptionReporter - SQL Error: 0, SQLState: null 127392 [ERROR] JDBCExceptionReporter - Was expecting a result set 127724 [WARN ] JDBCExceptionReporter - SQL Error: 0, SQLState: null 127968 [ERROR] JDBCExceptionReporter - Was expecting a result set 127983 [ERROR] JDBCExceptionReporter - could not insert: [com.dataart.newham.util.LogRecord] java.sql.SQLException: Was expecting a result set at net.sourceforge.jtds.jdbc.PreparedStatement_base.executeQuery(PreparedStatement_base.java:203) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:205) at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:508) at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:432) The problem is in executeQuery() method: you should not use this method on complex statements, because they produce more than one result. I've fixed it, diff file for EntityPersister attached. There's workaround for this problem: it is enough to override public String appendIdentitySelectToInsert(String insertSQL) and return null. But I hope my solution is a bit more usable one. 508c494,497 < return getGeneratedIdentity( object, session, insertSelect.executeQuery() ); --- > insertSelect.execute(); > while (insertSelect.getResultSet() == null) > insertSelect.getMoreResults(); > return getGeneratedIdentity( object, session, insertSelect.getResultSet() ); 519d507 <

    Hibernate JIRA | 1 decade ago | Alexey Filippov
    java.sql.SQLException: Was expecting a result set
  3. 0

    Unprocessed data in input buffer - exception

    jtds | 1 decade ago | rejki
    java.sql.SQLException: net.sourceforge.jtds.jdbc.TdsException: Unprocessed data in input buffer.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Error when trying to select a report

    oreports | 1 decade ago | *anonymous
    java.sql.SQLException: Was expecting a result set at net.sourceforge.jtds.jdbc.PreparedStatement\_base.executeQuery(Unknown Source)
  6. 0

    can log in... can not add any users!

    oreports | 1 decade ago | kraulin
    java.sql.SQLException: Was expecting a result set at net.sourceforge.jtds.jdbc.PreparedStatement\_base.executeQuery(Unknown Source)

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.sql.SQLException

      Was expecting a result set

      at net.sourceforge.jtds.jdbc.PreparedStatement_base.executeQuery()
    2. jTDS
      PreparedStatement_base.executeQuery
      1. net.sourceforge.jtds.jdbc.PreparedStatement_base.executeQuery(PreparedStatement_base.java:203)
      1 frame
    3. Commons DBCP
      DelegatingPreparedStatement.executeQuery
      1. org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:205)
      1 frame
    4. net.sf.hibernate
      EntityPersister.insert
      1. net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:508)
      2. net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:432)
      2 frames