micronaut-projects / micronaut-projects/micronaut-data

Hibernate Second Level Cache

Open
#1,671 2 comments 1 reaction 0 assignees View on GitHub
status: awaiting feedback
Dominant language
Java
Stars
482
Forks
229
Avg merge
1d 7h
Merged PRs (30d)
32

Description

### Expected Behavior

Fetch Entity only from hazelcast cache.

### Actual Behaviour

First Query database to Retrieve Entity and then Fetch that from cache.
`
14:02:41.187 [io-executor-thread-2] DEBUG o.h.c.s.s.AbstractReadWriteAccess#281 TraceId : Checking writeability of read-write cache item [timestamp='6796328713736192', version='0'] : txTimestamp='6796328800944128', newVersion='0'
14:02:41.187 [io-executor-thread-2] DEBUG o.h.c.s.s.AbstractReadWriteAccess#112 TraceId : Cache put-from-load
`

### Steps To Reproduce

1- Configure Hibernate lv2 cache with this config :
![dependency](https://user-images.githubusercontent.com/11288751/182020091-71905313-de6a-46b3-9955-7d72825d19c1.png)

2- add dependency to build.gradle
![dependency](https://user-images.githubusercontent.com/11288751/182019584-091afb78-99fb-4faf-9be1-2137078184bb.png)

3- annotate Entities this `@Cacheable` and `@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)`

### Environment Information

- Windows 10
- JDK 17 (Adoptium)
- Hazelcast 5.1.2

### Example Application

_No response_

### Version

3.4.2

Contributor guide

Open the contributing guide

Research direction

Start with the Hibernate second-level cache configuration shown in the issue, the dependency in build.gradle, and the entities annotated with @Cacheable and READ_WRITE. Reproduce on JDK 17 with Hazelcast 5.1.2 and inspect the logged database query and cache put-from-load sequence; done means repeated entity fetches come from Hazelcast without the initial database query.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.