Hello Developers,
I recently upgraded hibernate to v6.1.6 from v5.4.33.
We have a table A and table B which is having one to many relation.
Also, the application is a legacy one so we are still using XML configuration and hbm.xml file.
My system.hbm.xml looks like this for these two tables
<class name="entity.TableA" table="table_a">
<id name="id">
<generator class="uuid"/>
</id>
<property name="CreatedDate" column="created_date"/>
<property name="Name" column="name"/>
<list name="Options" inverse="true" cascade="all-delete-orphan">
<key column="value"/>
<index column="seq_num"/>
<one-to-many class="entity.TableB"/>
</list>
</class>
<class name="entity.TableB" table="table_b">
<id name="id">
<generator class="uuid"/>
</id>
<property name="CreatedDate" column="created_date"/>
<property name="SeqNum" column="seq_num"/>
<property name="Value" column="value"/>
<many-to-one name="Field" not-null="true" column="name"/>
</class>
And I am trying to run a select query on the table_a like this
String hql = "from TableA"
Query query = session.createQuery(hql);
List found = query.list();
which is throwing this error.
Exception in thread "main" jakarta.persistence.PersistenceException: Converting `org.hibernate.sql.exec.ExecutionException` to JPA `PersistenceException` : A problem occurred in the SQL executor : Error advancing (next) ResultSet position
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:165)
at org.hibernate.query.spi.AbstractSelectionQuery.list(AbstractSelectionQuery.java:374)
at org.hibernate.query.sqm.internal.QuerySqmImpl.list(QuerySqmImpl.java:1073)
at HibernateUtil.query(HibernateUtil.java:78)
at HibernateUtil.findFields(HibernateUtil.java:126)
at HibernateImpl.main(HibernateImpl.java:11)
Caused by: org.hibernate.sql.exec.ExecutionException: A problem occurred in the SQL executor : Error advancing (next) ResultSet position
at org.hibernate.sql.results.jdbc.internal.JdbcValuesResultSetImpl.makeExecutionException(JdbcValuesResultSetImpl.java:251)
at org.hibernate.sql.results.jdbc.internal.JdbcValuesResultSetImpl.advanceNext(JdbcValuesResultSetImpl.java:208)
at org.hibernate.sql.results.jdbc.internal.JdbcValuesResultSetImpl.processNext(JdbcValuesResultSetImpl.java:85)
at org.hibernate.sql.results.jdbc.internal.AbstractJdbcValues.next(AbstractJdbcValues.java:29)
at org.hibernate.sql.results.internal.RowProcessingStateStandardImpl.next(RowProcessingStateStandardImpl.java:88)
at org.hibernate.sql.results.spi.ListResultsConsumer.consume(ListResultsConsumer.java:197)
at org.hibernate.sql.results.spi.ListResultsConsumer.consume(ListResultsConsumer.java:33)
at org.hibernate.sql.exec.internal.JdbcSelectExecutorStandardImpl.doExecuteQuery(JdbcSelectExecutorStandardImpl.java:443)
at org.hibernate.sql.exec.internal.JdbcSelectExecutorStandardImpl.executeQuery(JdbcSelectExecutorStandardImpl.java:166)
at org.hibernate.sql.exec.internal.JdbcSelectExecutorStandardImpl.list(JdbcSelectExecutorStandardImpl.java:91)
at org.hibernate.sql.exec.spi.JdbcSelectExecutor.list(JdbcSelectExecutor.java:31)
at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.lambda$new$0(ConcreteSqmSelectQueryPlan.java:113)
at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.withCacheableSqmInterpretation(ConcreteSqmSelectQueryPlan.java:335)
at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.performList(ConcreteSqmSelectQueryPlan.java:276)
at org.hibernate.query.sqm.internal.QuerySqmImpl.doList(QuerySqmImpl.java:571)
at org.hibernate.query.spi.AbstractSelectionQuery.list(AbstractSelectionQuery.java:363)
... 4 more
Caused by: org.hibernate.exception.GenericJDBCException: Error advancing (next) ResultSet position
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:61)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:95)
... 20 more
Caused by: java.sql.SQLException: Closed Resultset: next
I need to make it working with hibernate v6.1.6.Final. Please guide me in resolving this, or if I am missing any configuration or something.
NOTE: This code works with Hibernate v5.6.14.Final without any error.