We're updating the issue view to help you get more done. 

NonBatchingBatch releases statements twice

Description

NonBatchingBatch in addToBatch() method calls jdbcCoordinator.release(Statement)) for every statement, and then calls releaseStatements method which calls {jrelease}} again. It causes an exception in JdbcCoordinatorImpl.close(Statement), and although the exception is caught it causes early exit and I think should be avoided.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 com.microsoft.sqlserver.jdbc.SQLServerException: The statement is closed. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190) at com.microsoft.sqlserver.jdbc.SQLServerStatement.checkClosed(SQLServerStatement.java:980) at com.microsoft.sqlserver.jdbc.SQLServerStatement.getMaxRows(SQLServerStatement.java:1011) at net.sf.log4jdbc.StatementSpy.getMaxRows(StatementSpy.java:949) at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.close(JdbcCoordinatorImpl.java:530) at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.release(JdbcCoordinatorImpl.java:407) at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.releaseStatements(AbstractBatchImpl.java:173) at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:76) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3281) at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:3183) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3525) at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:158) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:453) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:345) at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:350) at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:56) at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1218)

Environment

MS SQL Server 2008 R2

Status

Assignee

Unassigned

Reporter

Szczepan Kuźniarz

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

4.3.1

Priority

Minor