spring-jpa

Provide Spring Data JPA guidelines for N+1 prevention and transaction management.

1|Updated Mar 16, 2026
One-click install
npx skills add https://github.com/iceflower/opencode-agents-and-skills --skill spring-jpa
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: spring-jpa
Source: https://github.com/iceflower/opencode-agents-and-skills/tree/main/skills/spring-jpa
Command: npx skills add https://github.com/iceflower/opencode-agents-and-skills --skill spring-jpa

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides best practices and patterns for efficiently working with Spring Data JPA and managing database transactions, helping you avoid common pitfalls like the N+1 problem and ensuring robust data operations.

Core Features & Use Cases

  • N+1 Problem Prevention: Learn techniques like fetch joins and EntityGraphs to optimize query performance.
  • Transaction Management: Understand @Transactional usage, propagation, and best practices for external API calls.
  • JPA Entity Conventions: Follow guidelines for entity design, auditing, and enum handling.
  • Spring Data Repository Patterns: Leverage derived queries, custom @Query annotations, and efficient pagination.
  • Use Case: When developing a new feature that involves creating or updating complex data relationships in a Spring Boot application, consult this Skill to ensure optimal database interaction and transaction safety.

Quick Start

Use the spring-jpa skill to find all users with a specific status and created after a given date.

Frequently Asked Questions about spring-jpa

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix the Spring Data JPA N+1 problem?

Fix the Spring Data JPA N+1 problem by applying fetch joins or EntityGraphs to optimize query performance. This prevents lazy loading from triggering multiple queries when fetching complex entity relationships.

What is the best way to manage transactions with @Transactional in Spring Boot?

Manage transactions with @Transactional in Spring Boot by understanding its propagation behaviors and applying best practices for external API calls. This ensures robust database operations and prevents data inconsistency.

How do I design JPA entities with proper conventions?

Design JPA entities with proper conventions by following guidelines for entity structure, auditing, and enum handling. This ensures efficient database interactions and maintainable data-centric applications.

How do I write derived queries and custom @Query annotations in Spring Data repositories?

Write derived queries and custom @Query annotations in Spring Data repositories by leveraging repository patterns and efficient pagination. This allows precise database interaction without boilerplate code.

Can I use Spring Data JPA for complex data relationships in my Spring Boot application?

Use Spring Data JPA for complex data relationships in your Spring Boot application to ensure optimal database interaction and transaction safety. It provides comprehensive guidelines for developing data-centric features.