Level two cache may not be enabled when using @Cacheable without/instead of @Cache in JBoss EAP

Solution Unverified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7
    • 6
  • Hibernate
    • 5
    • 4
  • Infinispan
    • 8
    • 5

Issue

  • Randomly, it is observed that level two cache is not enabled when using @javax.persistence.Cacheable annotations instead of @org.hibernate.annotations.Cache
  • This has been reproduced only when deploying multiple persistence units (some with cache disabled, some with cache enabled)

Resolution

  • EAP 6 The issue is resolved in EAP 6.4 cumulative patch (CP) 15 and later 6.4 patch levels
  • EAP 7 Pending resolution in a future cumulative patch
  • As a workaround, @org.hibernate.annotations.Cache may be used in addition to the JPA @Cacheable annotation.

Root Cause

This is a known race condition (Content from issues.jboss.org is not included.JBEAP-9161).

Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.