Adam Bien's Weblog
You Don't Need To Think About Transactions If:
- Your application has no persistence and do not interact with transactional resources like messaging, legacy interfaces etc.
- The application is used only by one user in sequential way in a single thread.
- It only reads the data and no one writes or if it only writes the data, and no one reads :-).
- The access to persistent storage, backend resources is performed in one (business) method.
- You don't need the "Unit Of Work" abstraction. So it is no problem if the application dies between method invocations and the data is partly processed.
- It's ok, if other applications, users etc. see the unfinished (uncommitted) activities in their applications.
You know such an application? :-). I hear from time time statements like: "This is just a report - so I don't need transactions - I'm only reading the data". In this particular case you would access the database without a defined transaction and especially isolation - so you will basically see a snapshot of the database (especially uncommitted changes).
Even if you totally ignore the transactions - you will still get the "Green Bar" in most cases. This is probably the reason, why transactions are often in fact ignored ...until the production :-).
Posted at 11:04AM Jun 29, 2008 by Adam Bien in Java EE 5 Architectures And Idioms | Kommentare[3]
[This entry is based on / extends my books: Enterprise Architekturen, Leitfaden fuer effiziente Software-Entwicklung and: Java EE 5 Architekturen, Patterns und Idiome]


