Cannot change transaction read-only property in the middle of a transaction

前端 未结 2 1519
难免孤独
难免孤独 2021-01-20 16:43

I am using BoneCP with Postgresql and Spring JdbcTemplate. When JdbcTemplate executes query and then tries to close the connection, it gets this exception:

2条回答
  •  灰色年华
    2021-01-20 16:51

    I ran into the same issue and was able to solve it by doing these two steps:

    • setting the isolation level by adding these statement: config.setDefaultTransactionIsolation("READ UNCOMMITTED");

    • commit every transaction before closing.

    I am not sure which one solved the problem or if both are necessary.

提交回复
热议问题