Skip to content

fix: make JSONB value types Serializable for Ehcache L2 cache (backport to 2.42)#24051

Merged
netroms merged 2 commits into
2.42from
backport/ehcache-serializable-jsonb-types-2.42
Jun 1, 2026
Merged

fix: make JSONB value types Serializable for Ehcache L2 cache (backport to 2.42)#24051
netroms merged 2 commits into
2.42from
backport/ehcache-serializable-jsonb-types-2.42

Conversation

@netroms
Copy link
Copy Markdown
Contributor

@netroms netroms commented May 31, 2026

Backport of #24042 to 2.42.

2.42 runs Ehcache 3.12 (SerializingCopier), which performs real Java serialization of L2-cached entity state. Every JSONB value type on a cached entity (and its whole object graph) must therefore implement java.io.Serializable, or it throws NotSerializableException at runtime.

Changes

  • RenderingObject extends Serializable (transitively covers Section/ValueTypeRenderingObject).
  • ApiTokenAttribute implements Serializable. This folds in fix: make ApiTokenAttribute Serializable for Ehcache L2 cache #24002, which was never backported to 2.42 even though ApiToken is L2-cached there — so 2.42 currently has the same latent regression. Required for the guard test to pass.
  • Adds CachedEntityJsonbSerializableTest, which walks the live Hibernate metamodel and asserts every JSONB value type on an L2-cached entity is Serializable, so this cannot regress silently.

Verification

Guard test run locally against Postgres on this branch: 2 tests, 0 failures.

AI Assisted

netroms and others added 2 commits June 1, 2026 02:44
…rt to 2.42)

Backport of #24042. 2.42 runs Ehcache 3.12 (SerializingCopier), which
performs real Java serialization of L2-cached entity state, so every JSONB
value type on a cached entity must implement java.io.Serializable.

- RenderingObject: extend Serializable (covers Section/ValueTypeRenderingObject)
- ApiTokenAttribute: implement Serializable (folds in #24002, never backported;
  ApiToken is L2-cached, so it hits the same NotSerializableException)
- add CachedEntityJsonbSerializableTest guard walking the live Hibernate
  metamodel so this cannot regress silently

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mvn dependency:analyze flags the new test's JsonBinaryType import as a
used-undeclared dependency. The ignoredNonTestScopedDependencies entry only
suppresses the scope check, not used-undeclared, so declare the dependency
explicitly (compile scope), matching master.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

@netroms netroms merged commit 453ae80 into 2.42 Jun 1, 2026
14 checks passed
@netroms netroms deleted the backport/ehcache-serializable-jsonb-types-2.42 branch June 1, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants