integrant

richiardiandrea 2021-02-18T05:58:09.053600Z

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?

sandqvist 2021-02-18T07:37:06.056300Z

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).

👍 1
richiardiandrea 2021-02-22T21:35:14.000500Z

yeah the thing is we currently have a layer on top of the repositories...services 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