Announcement Announcement Module
Collapse
No announcement yet.
about second-level cache and transactions Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • about second-level cache and transactions

    hello I am a new spring user and I had a question

    a application use hibernate and second-level cache(ehcache) without spring.

    another application use hibernate+spring and second-level cache

    the two applications use the same database

    I want to know whether spring's transactionManager can synchronize the data in second-level cache :roll: .

    whether I must update the first application to use hibernate+spring?

    thanks

  • #2
    The transaction manager only takes care of the transaction - open/commit or rollback; Spring is just a wrapper around Hibernate in the end so the usual rules for caching apply.

    The problem in your case is that the database can be modified outside of Hibernate, I think timestamp strategy is going to help in this case (especially with EhCache).

    Comment


    • #3
      ok I think I know
      thanks

      Comment


      • #4
        What you need to do is coordinate the caches. In this case a clustered cache in which both applications participate in the cluster would handle this case.

        Versioning (as with a timestamp) will only help prevent you from over-writing changes, it won't prevent you from reading stale data.

        Comment


        • #5
          Steven is right about stale data - try JBoss TreeCache, it's free and well integrated with Hibernate; also take a look at OSCache. EhCache doesn't has cluster support.

          Comment


          • #6
            but as I know , only JBoss TreeCache has cluster support. and it must be running on JBoss server.

            the problem is the first application is not a J2EE application, and running without any J2EE contianer or Servlet container. It is a SMS content service provider,use socket communicate to gateway. it is a low-layer application and must contianer-unrelated(my boss order me)

            the second application(the web app), is a MMS content provider,MMS's content must use XML format and communicate to gateway by http post.

            my problem is the text type content must be shared with SMS and MMS,(for example user's information , service orders........)
            also in the future shared with WAP web site......

            and the two application , now running on the same machine ,but in the future, maybe running on different machine

            if I use JBoss treecache, how the frist application to do ????

            Comment


            • #7
              but as I know , only JBoss TreeCache has cluster support. and it must be running on JBoss server
              It should run standalone. See this FAQ.

              Comment


              • #8
                thanks very much

                Comment


                • #9
                  FAQ has moved to here.

                  Comment

                  Working...
                  X