How to use this doc in Notion: Import this
.mdfile (Settings → Import → Text & Markdown). Every##becomes a Notion heading (collapsible if you toggle it), every>becomes a callout-style quote block, and code fences render as code blocks. Add a “Confidence” tag (🟢/🟡/🔴) next to each heading as you revise.
Short Answer: JPA is a specification (interfaces like EntityManager, EntityManagerFactory); Hibernate is the most popular implementation of that spec. Spring Data JPA sits on top of both and auto-generates repository implementations.
Deep Dive — the layers:
Your Code
↓
Spring Data JPA (Repository interfaces — no SQL written)
↓
JPA (spec: EntityManager, @Entity, JPQL)
↓
Hibernate (implementation: SessionFactory, Session, HQL, caching)
↓
JDBC (driver-level, raw SQL)
↓
Database
Example:
public interface UserRepository extends JpaRepository<User, Long> {
Optional<User> findByEmail(String email); // Spring Data generates the query
}
💡 What they’re checking: Whether you know JPA ≠ Hibernate (many candidates conflate them), and whether you understand why the abstraction exists — portability across ORM vendors (EclipseLink, OpenJPA).
Short Answer: Use @Query(nativeQuery = true) on a repository method, or entityManager.createNativeQuery().
Example: