Tagged “Spring-Data”
4 articles with this tag.
- Auditing & migrationsKeeping data history and schema under control: Spring Data JPA auditing (@CreatedDate, @LastModifiedBy, AuditorAware), Hibernate Envers revision history, database triggers and CDC as alternatives; versioned schema migrations with Flyway and Liquibase in Spring Boot, naming and ordering, zero-downtime expand–contract changes, testing migrations, and running them in Kubernetes.
- Mappings & fetchingMapping relationships with JPA: @OneToMany, @ManyToOne, @OneToOne and @ManyToMany, owning side and mappedBy, bidirectional helpers, cascades and orphan removal, embeddables, inheritance strategies; fetch types and their defaults, LazyInitializationException, the N+1 query problem and its fixes (fetch joins, entity graphs, batch fetching, projections), and equals/hashCode for entities.
- JPQL & Criteria APIHow to query JPA entities: JPQL syntax (joins, fetch joins, projections, aggregates, subqueries), named and native queries, parameter binding and injection safety, the type-safe Criteria API and metamodel, Spring Data Specifications and Query by Example, Querydsl, keyset pagination with Spring Data, and choosing the right tool.
- Spring Data JPA & HibernateHow JPA, Hibernate and Spring Data fit together: the persistence context as a unit of work and first-level cache, entity states (transient, managed, detached, removed), flush modes and dirty checking, save vs merge, repositories and derived queries, projections, open-session-in-view, batching, identifier generation, and what changed in Hibernate 7 and Jakarta Persistence 3.2.