java - How to manage Repository and UnitOfWork on top of JDBC -
i'm wondering best way of implementing unitofwork pattern on top of jdbc when using repository pattern.
i want use uow commit or rollback commands potentially multiple different repositories. came repositories connection going execute commands on uow object , let manage committing or rolling back.
now question how shall uow manage connections? shall 1 connection on start of cycle , share repositories when call connection , @ end either commit or roll back. or shall let datasource manage connections, , keep reference connections obtained in 1 session in order able commit or rollback of them?
which way use best out of connection pooling , have less trouble in managing connections?
maybe worth noting use single threaded approach, meaning whole cycle (single uow) run on single thread , there no fancy multithreading management required neither in uow nor in repositories. multiple cycles may run in parallel each on own thread.
Comments
Post a Comment