Fork me on GitHub
#sql
<
2021-07-15
>
indy13:07:46

Hello, I'm trying to get the transaction state, getTransactionState from a Postgres PgConnection that is wrapped in a HikariProxyConnection , but it throws

No matching field found: unwrap for class com.zaxxer.hikari.pool.HikariProxyConnection
I've checked the source for HikariProxyConnection which extends ProxyConnection and which in turn does implement unwrap. The following is what I would like to run successfully,
(.getTransactionState (.unwrap (jdbc/get-connection (config/db-spec))))
P.S. This is for some logging while debugging an impenetrable race condition where starting a read-only transaction throws Cannot change transaction read-only property in the middle of a transaction.

indy15:07:47

Nevermind, had to do this,

(.getTransactionState (.unwrap (jdbc/get-connection (config/db-spec)) org.postgresql.jdbc.PgConnection))