home / skills / partme-ai / full-stack-skills / spring-data-jpa
This skill provides guidance for Spring Data JPA repositories, entity management, and queries to help build robust data access layers.
npx playbooks add skill partme-ai/full-stack-skills --skill spring-data-jpaReview the files below or copy the command above to add this skill to your agents.
---
name: spring-data-jpa
description: Provides comprehensive guidance for Spring Data JPA including repositories, entity management, query methods, and database operations. Use when the user asks about Spring Data JPA, needs to work with JPA repositories, implement data access layers, or configure JPA in Spring.
license: Complete terms in LICENSE.txt
---
## When to use this skill
Use this skill whenever the user wants to:
- [待完善:根据具体工具添加使用场景]
## How to use this skill
[待完善:根据具体工具添加使用指南]
## Best Practices
[待完善:根据具体工具添加最佳实践]
## Keywords
[待完善:根据具体工具添加关键词]
This skill provides practical, hands-on guidance for Spring Data JPA, covering repository design, entity mapping, query methods, transactions, pagination, and performance tuning. It helps developers implement robust data access layers, configure JPA in Spring Boot, and resolve common pitfalls. The guidance is focused on actionable patterns, code examples, and configuration tips for real-world applications.
The skill inspects user questions about JPA repositories, entity relationships, query generation, and configuration and returns targeted recommendations and example code snippets. It explains when to use derived queries, @Query annotations, Specification/Criteria API, and custom repository implementations. It also addresses transaction boundaries, lazy vs eager fetching, and strategies for optimizing SQL and preventing common ORM issues.
When should I use a custom repository implementation?
Use custom implementations for complex persistence logic, batch operations, or when you need access to EntityManager beyond what derived queries provide.
How do I avoid N+1 queries?
Use JOIN FETCH in JPQL or entity graphs, adjust fetch types, or use batch fetching and careful DTO projection to limit queries.