jpa-patterns
Skill87 starsChanged 7 months agoMITView on GitHub
JPA/Hibernate patterns for entity design, relationships, query optimization, transactions, auditing, indexing, pagination, and pooling in Spring Boot.
18 other projects use a version of this, 12 of them edited.
Adopted by
Most recently taken up by
- templetongroup/radiantedited, first seen Sep 17, 2026
- decebals/claude-code-javatheir own version, first seen Sep 6, 2026
- SamuelNDCE/claude-super-skill-libraryedited, first seen Aug 1, 2026
- JunMystery/Agent-Guidance-Pythonedited, first seen Jul 21, 2026
- Lukasbrujula/claude-code-frameworkword for word, first seen Jul 6, 2026
- piomin/spring-boot-app-with-claudecodetheir own version, first seen May 26, 2026
Used with
Projects with it also use everything-claude-code.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
InfopibeSkilleverything-claude-code
Also in 4 projects that use this
Other versions18 projects use a version of this.
Word for word · 2
- FaisalAlqarni/sp-ecc★ 9100% same
- Lukasbrujula/claude-code-framework★ 4100% same
Edited · 12
- xu-xiang/everything-claude-code-zh★ 2k47% same
- loulanyue/awesome-claude-notes★ 27290% same
- tpavanipradeep/everything-claude-code★ 13490% same
- templetongroup/radiant★ 11387% same
- codelably/harmony-claude-code★ 4349% same
- Infopibe/everything-claude-code★ 890% same
- JunMystery/Agent-Guidance-Python★ 290% same
- ashutoshrathi0909-oss/everything-claude-code★ 190% same
- iCesofT/awesome-ai★ 177% same
- royaluniondesign-sys/claude-os★ 190% same
2 more not listed
Wrote their own version · 4
- piomin/claude-ai-spring-boot★ 1.3ksame name
- decebals/claude-code-java★ 747same name
- minghaoZhangZ/shipkit★ 1same name
- piomin/spring-boot-app-with-claudecode★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository182 other files it gives its agents.
- accessibilitySkill
- agent-evalSkill
- agent-harness-constructionSkill
- agentic-engineeringSkill
- agent-introspection-debuggingSkill
- agent-payment-x402Skill
- agent-sortSkill
- ai-first-engineeringSkill
- ai-regression-testingSkill
- android-clean-architectureSkill
- api-connector-builderSkill
- api-designSkill
- architecture-decision-recordsSkill
- article-writingSkill
- automation-audit-opsSkill
- autonomous-agent-harnessSkill
- autonomous-loopsSkill
- backend-patternsSkill
- benchmarkSkill
- blueprintSkill
- brand-voiceSkill
- browser-qaSkill
- bun-runtimeSkill
- canary-watchSkill
- carrier-relationship-managementSkill
- ckSkill
- gemini-apiSkill
- gemini-devfleetSkill
- clickhouse-ioSkill
- click-path-auditSkill
- codebase-onboardingSkill
- code-tourSkill
- coding-standardsSkill
- compose-multiplatform-patternsSkill
- configure-eccSkill
- connections-optimizerSkill
- content-engineSkill
- content-hash-cache-patternSkill
- context-budgetSkill
- continuous-agent-loopSkill
- continuous-learningSkill
- continuous-learning-v2Skill
- cost-aware-llm-pipelineSkill
- councilSkill
- cpp-coding-standardsSkill
- cpp-testingSkill
- crosspostSkill
- csharp-testingSkill
- customer-billing-opsSkill
- customs-trade-complianceSkill
- dart-flutter-patternsSkill
- dashboard-builderSkill
- database-migrationsSkill
- data-scraper-agentSkill
- deep-researchSkill
- defi-amm-securitySkill
- deployment-patternsSkill
- design-systemSkill
- django-patternsSkill
- django-securitySkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
12 rules. 5 are common, 0 are distinctive, and 7 are very specific to this project.
5
Common
Most of the 11 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Common: line 8
Use for data modeling, repositories, and performance tuning in Spring Boot.
- Very specific: line 50
Default to lazy loading; use JOIN FETCH in queries when needed
- Very specific: line 51
Avoid EAGER on collections.
- Common: line 69
Use projections for lightweight queries:
- Very specific: line 82
Use @Transactional(readOnly = true) for read paths to optimize
- Very specific: line 106
Add indexes for common filters (status, slug, foreign keys)
- Very specific: line 107
Use composite indexes matching query patterns (status, created_at)
- Very specific: line 108
Avoid select *; project only needed columns
- Common: line 133
Use Flyway or Liquibase; never rely on Hibernate auto DDL in production
- Common: line 134
Keep migrations idempotent and additive.
- Very specific: line 138
Prefer @DataJpaTest with Testcontainers to mirror production
- Common: line 141
Remember: Keep entities lean, queries intentional, and transactions short.
“Common” is measured: kept by at least 6 in 10 of the 11 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
JPA/Hibernate Patterns
Use for data modeling, repositories, and performance tuning in Spring Boot.
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 {}Relationships and N+1 Prevention
@OneToMany(mappedBy = "market", cascade = CascadeType.ALL, orphanRemoval = true)
private List<PositionEntity> positions = new ArrayList<>();- Default to lazy loading; use
JOIN FETCHin queries when needed - Avoid
EAGERon collections; use DTO projections for read paths
@Query("select m from MarketEntity m left join fetch m.positions where m.id = :id")
Optional<MarketEntity> findWithPositions(@Param("id") Long id);Repository Patterns
public interface MarketRepository extends JpaRepository<MarketEntity, Long> {
Optional<MarketEntity> findBySlug(String slug);
@Query("select m from MarketEntity m where m.status = :status")
Page<MarketEntity> findByStatus(@Param("status") MarketStatus status, Pageable pageable);
}- Use projections for lightweight queries:
public interface MarketSummary {
Long getId();
String getName();
MarketStatus getStatus();
}
Page<MarketSummary> findAllBy(Pageable pageable);Transactions
- Annotate service methods with
@Transactional - Use
@Transactional(readOnly = true)for read paths to optimize - Choose propagation carefully; avoid long-running transactions
@Transactional
public Market updateStatus(Long id, MarketStatus status) {
MarketEntity entity = repo.findById(id)
.orElseThrow(() -> new EntityNotFoundException("Market"));
entity.setStatus(status);
return Market.from(entity);
}Pagination
PageRequest page = PageRequest.of(pageNumber, pageSize, Sort.by("createdAt").descending());
Page<MarketEntity> markets = repo.findByStatus(MarketStatus.ACTIVE, page);For cursor-like pagination, include id > :lastId in JPQL with ordering.
Indexing and Performance
- Add indexes for common filters (
status,slug, foreign keys) - Use composite indexes matching query patterns (
status, created_at) - Avoid
select *; project only needed columns - Batch writes with
saveAllandhibernate.jdbc.batch_size
Connection Pooling (HikariCP)
Recommended properties:
spring.datasource.hikari.maximum-pool-size=20
spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.validation-timeout=5000For PostgreSQL LOB handling, add:
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=trueCaching
- 1st-level cache is per EntityManager; avoid keeping entities across transactions
- For read-heavy entities, consider second-level cache cautiously; validate eviction strategy
Migrations
- Use Flyway or Liquibase; never rely on Hibernate auto DDL in production
- Keep migrations idempotent and additive; avoid dropping columns without plan
Testing Data Access
- Prefer
@DataJpaTestwith Testcontainers to mirror production - Assert SQL efficiency using logs: set
logging.level.org.hibernate.SQL=DEBUGandlogging.level.org.hibernate.orm.jdbc.bind=TRACEfor parameter values
Remember: Keep entities lean, queries intentional, and transactions short. Prevent N+1 with fetch strategies and projections, and index for your read/write paths.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

