Using transactions in all CRUD operations
JORGE MALDONADO <[email protected]> Wed, 6 Nov 2019 18:42:15 -0600
| Newsgroups | gmane.comp.db.postgresql.sql |
|---|---|
| Message-ID | <CAAY=A7-2mXGycTAjqF8xEUga5YnY8YxAZWD=YaTfooZeXq=GKw@mail.gmail.com> |
--0000000000007608100596b6f0dc
Content-Type: text/plain; charset="UTF-8"
Hello,
I am developing an information system applying several design patterns
being the Unit of Work one of them. For this pattern, my code automatically
implements the use of transactions and this means that all of the DB CRUD
operations will use them: INSERT, UPDATE, DELETE AND SELECT statements. It
makes sense to me that all of these operations, except for the SELECT
statement, make use of transactions. However, my Unit of Work design
pattern has them implemented by default. I have read some articles about
using transactions on SELECT statements and have seen that it is not as
absurd as it seems to me to use transactions with only SELECT statements
inside. My main reason to use transactions in all CRUD operations is to
maintain my Unit of Work design pattern standard. If using transactions for
all CRUD operations is not a good practice or not recommendable, then I
have to choice to re-design my code
I will very much appreciate your valuable feedback on this topic.
Respectfully,
Jorge Maldonado
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Libre
de virus. www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
--0000000000007608100596b6f0dc
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Hello,</div><div><br></div><div>I am developing=C2=A0=
an information system applying several=C2=A0design patterns being the Unit =
of Work one of them. For this pattern, my code automatically implements the=
use of transactions and this means that all of the DB CRUD operations will=
use them: INSERT, UPDATE, DELETE AND SELECT statements. It makes sense to =
me that all of these operations, except for the SELECT statement, make use =
of transactions. However, my Unit of Work design pattern has them implement=
ed by default. I have read some articles about using transactions on SELECT=
statements and have seen that it is not as absurd as it seems to me to use=
transactions with only SELECT statements inside. My main reason to use tra=
nsactions in all CRUD operations is to maintain my Unit of Work design patt=
ern standard. If using transactions for all CRUD operations is not a good p=
ractice or not recommendable, then I have to choice to re-design my code</d=
iv><div><br></div><div>I will very much appreciate your valuable feedback o=
n this=C2=A0topic.</div><div><br></div><div>Respectfully,</div><div>Jorge M=
aldonado</div></div><div id=3D"DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br> <=
table style=3D"border-top:1px solid #d3d4de">
<tr>
<td style=3D"width:55px;padding-top:18px"><a href=3D"https://www.avas=
t.com/sig-email?utm_medium=3Demail&utm_source=3Dlink&utm_campaign=
=3Dsig-email&utm_content=3Dwebmail" target=3D"_blank"><img src=3D"https=
://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-n=
o-repeat-v1.gif" alt=3D"" width=3D"46" height=3D"29" style=3D"width: 46px; =
height: 29px;"></a></td>
<td style=3D"width:470px;padding-top:17px;color:#41424e;font-size:13px;fo=
nt-family:Arial,Helvetica,sans-serif;line-height:18px">Libre de virus. <a h=
ref=3D"https://www.avast.com/sig-email?utm_medium=3Demail&utm_source=3D=
link&utm_campaign=3Dsig-email&utm_content=3Dwebmail" target=3D"_bla=
nk" style=3D"color:#4453ea">www.avast.com</a> </td>
</tr>
</table>
<a href=3D"#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width=3D"1" height=3D"1">=
</a></div>
--0000000000007608100596b6f0dc--