How to make my pojos transaction?

I have a multi-threaded multi-server web application with hibernate and spring transaction management with AOP. The problem is that I need to maintain the data in memory and keep it in a state of database state ... essentially I implement a cache in memory.

Now, is there a way to make the my-in-memory pojos transaction at the same level as the / spring sleep transaction? I have service calls with a depth of 30 classes and I never know where the commit will take place. What are my options?

+3
source share
2 answers

, - , . , , :

  • Thread T1 pojo P , P1.
  • Thread T2 pojo P , P1.
  • T2 , pojo, , P2.
  • Thread T1 pojo P , P1. , 3 T2 P2 P1, .
  • Thread T2 P, T1 T2, .
  • T2 :
    . , T2 P1, T1.
    . commit, T2 P2. T1 P2.

, , . , , ( , ...). , . , ;-)

-, , - !


.

(AOP, ThreadLocal), .

  • , / AOP, .

  • P ( , ): Store , ThreadLocal Store. ThreadLocal :

    • AOP-,
    • ThreadLocal ( ..)
    • , ThreadLocal , CACHE.
    • ThreadLocal ; Store, ; , ( API API ).
    • ThreadLocal, CACHED
    • ThreadLocal, CACHED CACHED
+2

Hibernate ? JBoss , .

, , , .

+1

Source: https://habr.com/ru/post/1718301/


All Articles