Fork me on GitHub

Hi there another question for this helpful group. I am trying to understand how to pass jdbc transactions to components like "repositories". It would mean replacing the db spec that I pass in at runtime but after the injection happens...thoughts?


I am also using duct here and I wonder if modules could be used in order to augment the component with the transaction object before injection


I recommend that you always pass the DB connection as a parameter to your repository functions. Inject your connection pool as close to the "input" side of your application. In a web app, I would inject it into the request object in a middleware. Then you can handle transactions normally (as in jdbc/with-db-transaction).

👍 3

yeah the thing is we currently have a layer on top of the and those gets the db injected and I am thinking of using with-transation within them...but then the repo's db has to come from them directly