JPA Interview Questions
💡 Click any question to read the full AI-powered answer.
Q1
How to fetch children in JPA with association?
✓ Answered
→
Q2
What is the difference between Lazy and Eager fetching?
✓ Answered
→
Q3
When should we use Lazy loading vs Eager loading?
✓ Answered
→
Q4
How can you fetch a LAZY association as EAGER in a NamedQuery?
✓ Answered
→
Q5
What is NamedEntityGraph?
✓ Answered
→
Q6
Explain entity states in JPA and the transitions between them.
✓ Answered
→
Q7
Explain what the merge() method does in JPA and how it differs from persist().
✓ Answered
→
Q8
What is the difference between merge() and update() in Hibernate?
✓ Answered
→
Q9
What is Flush Mode in JPA and how does it affect persistence context synchronization?
✓ Answered
→
Q10
How can you tune Hibernate or JPA for high throughput systems?
✓ Answered
→
Q11
What is StatelessSession in Hibernate and when would you use it for bulk migration?
✓ Answered
→
Q12
Explain composite keys in JPA and how they are implemented.
✓ Answered
→
Q13
How do you implement composite keys using Spring Data JPA repositories?
✓ Answered
→
Q14
Explain the different inheritance mapping strategies in JPA.
✓ Answered
→
Q15
What are Hibernate event listeners and when are they used?
✓ Answered
→
Q16
How do you configure Ehcache as a second-level cache provider in Hibernate or JPA?
✓ Answered
→
Q17
How can Redis be used as a second-level cache provider in Hibernate or JPA?
✓ Answered
→
Q18
Where is cache stored in JPA when second-level caching is enabled?
✓ Answered
→
Q19
When using Ehcache as a second-level cache, where is the cache stored and how is it managed?
✓ Answered
→
Q20
What is the difference between JOIN FETCH and Entity Graph in JPA?
✓ Answered
→