Modernization of my project. Here I am thinking about transactions. Well, the thing is, I'm not quite sure when to use transactions for my Hibernate requests in Spring. It’s not that I don’t completely understand what kind of transactions I have, I think, but should I use transactions for type queries get*just setting an attribute read-only?
get*
read-only
<tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <!-- all methods starting with 'get' are read-only --> <tx:method name="get*" read-only="true" /> <!-- other methods use the default transaction settings --> <tx:method name="*" /> </tx:attributes> </tx:advice>
How effective is this for queries get*? Since, as it seems to me, the use of transactions should be performed both for updating, inserting, deleting and such requests. Did I miss something?
The use of transactions is somewhat dependent on the requirement.
, UPDATE DELETE . SELECT , , , , / . , , -.
(.. SELECT, UPDATE, DELETE).
, . , -. , , , , , / , (, , ).
Spring .
, . . , , , .
DAO. , A, , . ( Hibernate) AOP , .
:
If you are using an AOP transaction with readOnly true and you have correctly configured the JPA dialogs for sleep mode, Spring puts the Hibernate session in non-flash mode. This can lead to significant performance improvements for high volume operations, eliminating unnecessary dirty checks. Therefore, it stands in this respect.