I'm trying to insert data to a global temporary table in Oracle from my application using Hibernate session. This data will then be used by a DB procedure called from the same application. The global temporary table was created with on commit delete rows
session.save();
session.save();
session.save();
session.flush();
However, I'm getting below error on session.flush() line
Hibernate: insert into GTT_CHG_DTLS (CAC_NUMBER, SKIP_CREDIT_CHECK, GTT_CHG_ID) values (?, ?, ?)
WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (default task-7) SQL Error: 14450, SQLState: 72000
ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (default task-7) ORA-14450: attempt to access a transactional temp table already in use
Caused by: org.hibernate.exception.GenericJDBCException: could not execute statement
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:178)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3193)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3707)
at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:90)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:604)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:478)
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:356)
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1472)
... 83 more
Caused by: java.sql.SQLException: ORA-14450: attempt to access a transactional temp table already in use