$npx skillfedfor your agent

spring-data-jpa

Build data access layers with Spring Data JPA repository interfaces, entity relationships, and query patterns. Configure CRUD operations, derived and custom queries, pagination, database auditing, and transaction management. Includes best practices for performance optimization and entity design.

Spring Data JPA helps you implement persistence layers by providing repository patterns, entity configuration, and query strategies for database operations.

AI-generated summary based on this skill's SKILL.md

311 37 MITupdated by giuseppe-trisciuoglio

Decision gist · record as of 2026-06-22

Spring Data JPA helps you implement persistence layers by providing repository patterns, entity configuration, and query strategies for database operations. Build data access layers with Spring Data JPA repository interfaces, entity relationships, and query patterns. Configure CRUD operations, derived and custom queries, pagination, database auditing, and transaction management. Includes best practices for performance optimization and entity design.

manual: git clone https://github.com/giuseppe-trisciuoglio/developer-kit → cp -r developer-kit/plugins/developer-kit-java/skills/spring-data-jpa ~/.claude/skills/spring-data-jpa
plugins/developer-kit-java/skills/spring-data-jpa/SKILL.md · version 8c9dd680

Use it when

  • spring-data-jpa supports one-to-one, one-to-many, many-to-one, and many-to-many relationships using @OneToOne, @OneToMany, @ManyToOne.
  • spring-data-jpa prevents N+1 problems using @EntityGraph annotations to specify which relationships to eagerly load in a single query.

Verify before relying

Read SKILL.md below before installing (3 files). Open directory: indexed for reading, not audited.

Same gist for agents: .md · .json

Install

giuseppe-trisciuoglio/developer-kit/spring-data-jpa · repository language: Python

Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How do you create JPA repositories in Spring Data JPA?

spring-data-jpa repositories are created by extending the Repository interface or its subinterfaces like CrudRepository or JpaRepository. Define an interface with generic type parameters for your entity and ID type, then Spring Data JPA automatically generates CRUD operation implementations at runtime. You can add custom query methods using derived method names or @Query annotations without writing implementation code.

What are spring data jpa entity relationships and how do you configure them?

spring-data-jpa supports one-to-one, one-to-many, many-to-one, and many-to-many relationships using @OneToOne, @OneToMany, @ManyToOne, and @ManyToMany annotations. Configure cascade types to control how operations propagate (PERSIST, MERGE, REMOVE, REFRESH, DETACH, ALL), set fetch strategies (LAZY or EAGER), and use mappedBy to define the owning side of bidirectional relationships for proper database synchronization.

How does spring data jpa prevent N+1 query problems?

spring-data-jpa prevents N+1 problems using @EntityGraph annotations to specify which relationships to eagerly load in a single query, or by using JOIN FETCH in @Query methods. Define named entity graphs on your entity class with @NamedEntityGraph, then reference them in repository methods to control exactly which associations load together, avoiding cascading SELECT queries.

What pagination setup is needed with Spring Data JPA?

spring-data-jpa pagination is configured by adding a Pageable parameter to repository methods and returning Page<T> instead of List<T>. Spring automatically handles limit, offset, and sorting. Create Pageable instances using PageRequest.of(pageNumber, pageSize, Sort.by(...)) in your service layer, then pass to repository methods that support pagination for efficient large dataset handling.

How do you write efficient queries using @Query annotations in spring-data-jpa?

spring-data-jpa @Query annotations let you write custom JPQL or native SQL queries directly on repository methods. Use parameter binding with @Param, projections to fetch only needed columns, and JOIN FETCH for relationships. Combine with @Modifying for UPDATE/DELETE operations and @Transactional for write operations to optimize performance beyond derived query capabilities.

How is database auditing configured in Spring Data JPA?

spring-data-jpa enables auditing by adding @EnableJpaAuditing to your configuration class and annotating entity fields with @CreatedDate, @LastModifiedDate, @CreatedBy, and @LastModifiedBy. Implement AuditorAware<T> to provide current user information, then Spring automatically populates timestamps and user references on entity creation and modification without manual code.

SKILL.md

Rendered from the published skill. Quoted content, verbatim.

Spring Data JPA

Overview

Provides patterns for Spring Data JPA repositories, entity relationships, queries, pagination, auditing, and transactions.

When to Use

Creating repositories with CRUD operations, entity relationships, @Query annotations, pagination, auditing, or UUID primary keys.

Instructions

Create Repository Interfaces

To implement a repository interface:

  1. Extend the appropriate repository interface: java @Repository public interface UserRepository extends JpaRepository&lt;User, Long&gt; { // Custom methods defined here }

  2. Use derived queries for simple conditions: java Optional&lt;User&gt; findByEmail(String email); List&lt;User&gt; findByStatusOrderByCreatedDateDesc(String status);

  3. **Implement custom queries with

(truncated - see the full file via the links below)

File tree — 3 files
plugins/developer-kit-java/skills/spring-data-jpa/SKILL.md
plugins/developer-kit-java/skills/spring-data-jpa/references/examples.md
plugins/developer-kit-java/skills/spring-data-jpa/references/reference.md

Let your AI agent find skills like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.

wish › “Implement persistence layer with Spring Data JPA repositories and entity relationships”

Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →

Related skills

jpa-patterns
by decebals · decebals/claude-code-java

This skill addresses the most common JPA performance bottlenecks: N+1 query problems, lazy loading errors, and transaction misconfigurations. It covers practical solutions like JOIN FETCH and EntityGraph for efficient data fetching, explains when to use LAZY vs EAGER loading, and demonstrates transaction management best practices for Spring applications.

MITfor claude-codeupdated Feb 2026
★ 693repo stars
Java Jpa Hibernate
by pluginagentmarketplace · pluginagentmarketplace/custom-plugin-java

Build scalable persistence layers with JPA and Hibernate through entity design, query strategies, and performance tuning. Learn to prevent N+1 queries, configure transactions, and implement caching across multiple database platforms. Covers relationship mapping, lazy loading optimization, and production-ready patterns.

no license declared → metadata onlyupdated Jan 2026
★ 40repo stars
jpa-patterns
by xu-xiang · xu-xiang/everything-claude-code-zh

Master JPA entity modeling, repository implementation, and performance tuning for Spring Boot applications. Learn to configure relationships, prevent N+1 query issues through fetch strategies and projections, set up transactional boundaries, and optimize database connections with HikariCP.

MITdocs in Chineseupdated Mar 2026
★ 1,767repo stars
kotlin-backend-jpa-entity-mapping
by Kotlin · Kotlin/kotlin-agent-skills

Master Spring Data JPA entity design in Kotlin by learning why regular classes outperform data classes for persistence, how to implement stable identity and equality semantics, and when to enforce uniqueness at both database and application layers. Covers fetch strategies, common ORM traps, and Kotlin-specific patterns for preventing N+1 queries and lazy-loading errors.

Apache-2.0updated Jul 2026
★ 971repo stars
springboot-patterns
by rohitg00 · rohitg00/awesome-claude-code-toolkit

This skill teaches Spring Boot's layered architecture pattern, organizing code into controllers, services, repositories, and entities. It covers REST endpoint design, JPA relationships with lazy loading, DTOs for request/response handling, transactional boundaries, and global exception handling.

Apache-2.0updated May 2026
★ 2,394repo stars
spring-boot-crud-patterns
by giuseppe-trisciuoglio · giuseppe-trisciuoglio/developer-kit

This skill scaffolds end-to-end CRUD operations for Spring Boot 3.5+ applications using feature-focused, domain-driven design patterns. It generates domain aggregates, repository contracts, JPA persistence adapters, application services, and REST controllers with proper separation of concerns and validation gates. Use it to build REST endpoints, implement database operations, or diagnose transaction boundaries in existing Spring Boot services.

MITupdated Jun 2026
★ 311repo stars
Tags
orm-frameworkquery-optimizationdata-persistencerelationship-mappingperformance-tuningtransaction-managementdatabase-indexinglazy-loading-strategy