Skip to content

Latest commit

 

History

History
31 lines (31 loc) · 2.2 KB

jpa_hibernate.md

File metadata and controls

31 lines (31 loc) · 2.2 KB

JPA / Hibernate

  • What is a difference between L1 cache, L2 cache and query cache?
  • What eviction policies of hibernate cache do you know?
  • What types or relations between entities do you know? What are differences between uni-directional and bi-directional relations?
  • Types of inheritance (table per class, table for hierarchy with discriminator column, joined tables etc.). Performance and data consistency implications of those strategies.
  • What is JPQL? What is Criteria API?
  • What is HQL? What are pros/cons of using HQL?
  • What is linking table? When it is created?
  • Which types of relations require a linking table? In which relations it is possible to avoid the linking table creation and where it is unavoidable?
  • What is N+1 problem and how to solve that (batch, fetch join)?
  • What is the difference between optimistic and pessimistic locking? Answer
  • ACID, Transaction isolation, propagation in JEE/Spring
  • What transaction phenomenas do you know? How isolation levels are preventing from those phenomenas to occur?
  • What is locked during each type of isolation?
  • What cascade types do you know? Why we have to be careful with cascading? Answer
  • List, Set in relations
  • How to make a good hashcode for entity?
  • Lazy fetching of collections. How does it work? How it relates to session?
  • What is a lifecycle of entity?
  • When to detach/merge entity?
  • Why default ctor is needed for entities?
  • What type of cache strategies do you know? (read, read_write, transactional etc.)
  • How do we mark the class to be persistable (from JPA perspective)?
  • How can we update database schema after making changes to java code?
  • What is the difference between INSERT and UPDATE?
  • What aggregation functions do you know?
  • What is a a FetchStrategy? Which one is default?
  • If you need to extend existing User entity with last login time what data types would you use on Java and DB levels? What variants can be used?
  • Rewrite the query to remove table joining: "select tab_a.col_a from tab_a join tab_b on tab_a.fid=tab_b.id where tab_b.col_b is not null;"
  • What is a difference between load and get?
  • How can we define a PK in JPA/Hibernate?