Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-991

Show how to invalidate JPA 2nd-level cache using Debezium

    XMLWordPrintable

Details

    • Task
    • Resolution: Done
    • Major
    • None
    • None
    • examples, website
    • None

    Description

      When using JPA with the 2nd-level cache enabled, it is required to invalidate cached items explicitly if the corresponding database records have been altered bypassing Hibernate (native queries, Criteria API bulk updates, patches directly in the DB itself etc.). Debezium can be used to achieve this task.

      We should provide a blog post / demo and perhaps even an integration module for Hibernate ORM which shows how to do this task:

      • Use the Debezium embedded engine to consume CDC events in the app that uses Hibernate
      • Call JPA 2.0's Cache API to evict any updated/deleted items

      The challenge is how to do it generically, i.e. we must be able to derive the entity key with the correct property type from the incoming change event. Another question is whether it'd be needed to avoid evictions caused by the application itself (in which case we'd somehow have to tell those apart from external updates).

      Attachments

        Activity

          People

            gunnar.morling Gunnar Morling
            gunnar.morling Gunnar Morling
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: