From 1294e35b983b9892834dcd83a0cafa43772bcbd0 Mon Sep 17 00:00:00 2001 From: Sean Corfield Date: Tue, 28 Jan 2025 10:11:25 -0800 Subject: [PATCH] fixes #293 Signed-off-by: Sean Corfield --- CHANGELOG.md | 1 + src/next/jdbc/transaction.clj | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 468e9c3..f24a0e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Only accretive/fixative changes will be made from now on. * 1.3.next in progress + * Fix [#293](https://github.com/seancorfield/next-jdbc/issues/293) by no longer `locking` on the `Connection` retrieved from a `DataSource`. * Fix documentation examples of `execute-batch!` via PR [#292](https://github.com/seancorfield/next-jdbc/pull/292) from [@devurandom](https://github.com/devurandom). * Update `java.data` to 1.3.113. * Beef up bit/boolean tests and enable them for XTDB. diff --git a/src/next/jdbc/transaction.clj b/src/next/jdbc/transaction.clj index 3497240..a61817e 100644 --- a/src/next/jdbc/transaction.clj +++ b/src/next/jdbc/transaction.clj @@ -145,7 +145,11 @@ javax.sql.DataSource (-transact [this body-fn opts] (with-open [con (p/get-connection this opts)] - (p/-transact con body-fn opts))) + ;; this connection is assumed unique so we do not need the active-tx check: + (let [raw (raw-connection con)] + ;; we don't lock either, per #293: + (binding [*active-tx* (conj *active-tx* raw)] + (transact* con body-fn opts))))) Object (-transact [this body-fn opts] (p/-transact (p/get-datasource this) body-fn opts)))