intermediateJPA & Hibernate Internals249 of 469
First-level vs Second-level cache
Tests whether you know first-level cache is mandatory, per-Session, and cleared when the Session closes, while second-level cache is optional, shared across sessions/SessionFactory, and needs careful invalidation to avoid serving stale data across instances.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response