affaan-m avatar

Jpa Patterns

This is a comprehensive reference for JPA and Hibernate patterns in Spring Boot, covering entity design, relationship mapping, and query optimization. You'll want this active when setting up repositories, preventing N+1 queries with fetch strategies, or tuning connection pooling and indexing. It includes concrete examples for auditing with EntityListeners, DTO projections to avoid eager loading, and practical HikariCP settings. The migration advice is solid: never use Hibernate auto DDL in production, stick with Flyway or Liquibase. The testing recommendation to use DataJpaTest with Testcontainers is the right call. It's dense but well organized, assumes you know Spring Boot basics, and focuses on the performance pitfalls that actually matter.

skills.sh installs
5.6K
GitHub stars
300.3K
last updated
Aug 21, 2026

Install

$ npx -y skills add affaan-m/ecc --skill jpa-patterns --agent claude-code

Installs into .claude/skills of the current project.

Files

JPA/Hibernate Patterns

Use for data modeling, repositories, and performance tuning in Spring Boot.

When to Activate

  • Designing JPA entities and table mappings
  • Defining relationships (@OneToMany, @ManyToOne, @ManyToMany)
  • Optimizing queries (N+1 prevention, fetch strategies, projections)
  • Configuring transactions, auditing, or soft deletes
  • Setting up pagination, sorting, or custom repository methods
  • Tuning connection pooling (HikariCP) or second-level caching

Entity Design

@Entity
@Table(name = "markets", indexes = {
  @Index(name = "idx_markets_slug", columnList = "slug", unique = true)
})
@EntityListeners(AuditingEntityListener.class)
public class MarketEntity {
  @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
  private Long id;

  @Column(nullable = false, length = 200)
  private String name;

  @Column(nullable = false, unique = true, length = 120)
  private String slug;

  @Enumerated(EnumType.STRING)
  private MarketStatus status = MarketStatus.ACTIVE;

  @CreatedDate private Instant createdAt;
  @LastModifiedDate private Instant updatedAt;
}

Enable auditing:

@Configuration
@EnableJpaAuditing
class JpaConfig {}

Sponsors

Details

Repository
github.com/affaan-m/ecc
Categories
Java & JVM, Design & UI/UX
First seen
Jul 14, 2026

More from affaan-m/ecc

All 263

Recommended

More Java & JVM
1apollographql avatarapollo-kotlinapollographql/skillsGuide for building applications with Apollo Kotlin, the GraphQL client library for Android and Kotlin. Use this skill when: (1) setting up Apollo Kotlin in a Gr1.8Kskills.sh installs
2vitorpamplona avatarkotlin-multiplatformvitorpamplona/amethystPlatform abstraction decision-making for Amethyst KMP project. Guides when to abstract vs keep platform-specific, source set placement (commonMain, jvmAndroid, 1.6Kskills.sh installs
3personamanagmentlayer avatarjava-expertpersonamanagmentlayer/pclExpert-level Java development with Java 21+ features, Spring Boot, Maven/Gradle, and enterprise best practices305skills.sh installs
4decebals avatarmaven-dependency-auditdecebals/claude-code-javaAudit Maven dependencies for outdated versions, security vulnerabilities, and conflicts. Use when user says "check dependencies", "audit dependencies", "outdate308skills.sh installs
5github avatarjava-mcp-server-generatorgithub/awesome-copilotGenerate a complete Model Context Protocol server project in Java using the official MCP Java SDK with reactive streams and optional Spring Boot integration.8.8Kskills.sh installs
6affaan-m avatarspringboot-verificationaffaan-m/eccVerification loop for Spring Boot projects: build, static analysis, tests with coverage, security scans, and diff review before release or PR.5.6Kskills.sh installs