0

I have hi load system with a big data table witch is frequently used.

To insert big batch of data in this table I use stored procedure which split this batch on a small parts(1000 records) and insert it.

This approach allows to do not lock a table for other operations for a long time

But when I try to execute this stored procedure from a service - framework wrap it in the transaction and block this table on a long time :( and it is very bad

  • I tried to execute query via Statement and set TRANSACTION_NONE to the Connection but receive: The TRANSACTION_NONE option is not currently supported by the setTransactionIsolation method.

  • Tried to execute via EntityManager and JPA but it also wrap query into transaction

So, does anyone know a solution to execute query without transaction via JPA?

Like a next example

@Repository
public interface SomeEntityRepository extends JpaRepository<SomeEntity, Long> {
    @Modifying
    @Transactional(???)
    @Query(
        value = "exec imp.spImportSomeData",
        nativeQuery = true)
    void importSomeData();
}

or other approach to execute procedure without transaction...

lkovalyk
  • 66
  • 4

0 Answers0