Skip to content
javabypankaj
HomeLibraryPopularCommunity
09
JPA & Hibernate
17 topics · 69 questions
1JPA Fundamentals0/552N+1 Problem & Fetching0/223Entity Mapping: Relationships0/554Entity Mapping: Keys, Columns & Annotations0/885Embeddable, Inheritance & Secondary Tables0/556Spring Data Repositories0/447Queries: JPQL, Native, Derived, Criteria0/668Projections: Interface, DTO, Dynamic0/449Entity Lifecycle & Auditing0/2210Locking: Optimistic & Pessimistic0/4411Pagination & Sorting0/3312Performance: Large IN, Dirty Checking, OSIV0/6613Flush, Persist & Cache0/514Cascade, Orphan Removal & Soft Delete0/2215Batch Processing0/2216Multi-Database & Migration0/2217Scheduling: @Scheduled, ShedLock, Retry0/44
1JPA Fundamentals52N+1 Problem & Fetching23Entity Mapping: Relationships54Entity Mapping: Keys, Columns & Annotations85Embeddable, Inheritance & Secondary Tables56Spring Data Repositories47Queries: JPQL, Native, Derived, Criteria68Projections: Interface, DTO, Dynamic49Entity Lifecycle & Auditing210Locking: Optimistic & Pessimistic411Pagination & Sorting312Performance: Large IN, Dirty Checking, OSIV613Flush, Persist & Cache514Cascade, Orphan Removal & Soft Delete215Batch Processing216Multi-Database & Migration217Scheduling: @Scheduled, ShedLock, Retry4
17 topics69 Qs0%
01Core Java17002OOP3203Collections6704Exception Handling2805Concurrency & Multithreading12706Java Streams, Lambda & Functional Programming32807Spring & Spring Boot2608Transactions3209JPA & Hibernate6910Microservices19411Kafka & Messaging9112DevOps, CI/CD & Tooling13313Database & SQL14114REST API & Web4015Design Patterns & LLD5716Advanced Java7117Coding Problems: DSA49218AWS & Cloud4119Data Engineering19420QA, Testing & SDET4121System Design3522Security2023Behavioral / HR: STAR Method37
17Topics
69Questions
0%Complete
13 of 17 topics
Topics
1JPA Fundamentals0/552N+1 Problem & Fetching0/223Entity Mapping: Relationships0/554Entity Mapping: Keys, Columns & Annotations0/885Embeddable, Inheritance & Secondary Tables0/556Spring Data Repositories0/447Queries: JPQL, Native, Derived, Criteria0/668Projections: Interface, DTO, Dynamic0/449Entity Lifecycle & Auditing0/2210Locking: Optimistic & Pessimistic0/4411Pagination & Sorting0/3312Performance: Large IN, Dirty Checking, OSIV0/66
13Flush, Persist & Cache0/55
14Cascade, Orphan Removal & Soft Delete0/2215Batch Processing0/2216Multi-Database & Migration0/2217Scheduling: @Scheduled, ShedLock, Retry0/44

Flush, Persist & Cache

JPA & Hibernate·Topic 13 of 17·5 questions
Q1session.evict() vs session.clear() vs detach()?

`evict()` and `detach()` remove one entity from tracking; `clear()` removes all; none touch the database row.

Read Answer
Q2save() vs saveAndFlush()?

`save()` buffers the SQL until flush time; `saveAndFlush()` forces the SQL out immediately -- both are still inside the transaction and can roll back.

Read Answer
Q3What is flush vs commit?

Flush sends SQL to the database now but keeps the transaction open; commit finalizes the transaction and makes changes permanent; flushed-but-uncommitted changes can be rolled back.

Read Answer
Q4Why does save() not immediately INSERT?

`save()` makes the entity managed and queues the INSERT; the SQL is deferred to flush or commit so Hibernate can batch and order statements.

Read Answer
Q5What are Hibernate flush modes?

AUTO flushes before affected queries and at commit; COMMIT flushes only at commit; MANUAL flushes only on explicit `flush()` calls.

Read Answer
Previous · Topic 12Performance: Large IN, Dirty Checking, OSIV6 questionsNext · Topic 14Cascade, Orphan Removal & Soft Delete2 questions
javabypankaj© 2026 javabypankaj
PrivacyTerms
HomeSearchLibrary