agentsclimarketplace

Spring boot data access

Skill ComeOnOliver/skillshub/skills/HoangNguyen0403/agent-skills-standard/spring-boot-data-access

Best practices for JPA, Hibernate, and Database interactions in Spring Boot. Use when implementing JPA entities, repositories, or database access in Spring Boot. (triggers: **/*Repository.java, **/*Entity.java, jpa-repository, entity-graph, transactional, n-plus-1)From its SKILL.md

Install
npx -y skills add ComeOnOliver/skillshub --skill spring-boot-data-access

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

2.0 KB, 434 tokens by cl100k_base, as published. Nobody here has run it

Spring Boot Data Access

Priority: P0

Implementation Guidelines

JPA & Hibernate (Spring Data JPA)

  • Read-Only: Default to @Transactional(readOnly = true) on Services to optimize DB resources.
  • Projections: Use Java Records for Read-Only query results. Avoid fetching full @Entity objects when not necessary.
  • Pagination: ALWAYS use Pageable and Slice (or Page) to prevent loading massive datasets.
  • Spring Data: Prefer JpaRepository and Query methods. Use @Query with JPQL for complex logic. Use Flyway or Liquibase for migrations; never use spring.jpa.hibernate.ddl-auto=create (ddl-auto) in production.

Query & Transaction Optimization

  • N+1 Problem: Fix N+1 selects using JOIN FETCH (JPQL) or @EntityGraph.
  • Open-In-View: Set spring.jpa.open-in-view=false in application.yaml.
  • Bulk Operations: Use @Modifying with @Query for updates/deletes to bypass EntityManager overhead.
  • Connection Pool: Configure HikariCP with explicit maximum-pool-size. Tune Hikari pool-size based on expected concurrent queries.

Anti-Patterns

  • No N+1 Selects: Use JOIN FETCH or @EntityGraph instead of lazy-loading in loops.
  • Entity Inflation: Don't use @Data (Lombok) on Entities as it breaks Proxy and hashCode/equals performance.
  • Transactional Leak: Don't put @Transactional on public Repository methods if the Service is already transactional.
  • Raw SQL: Avoid native SQL unless JPQL/Criteria API is insufficient.

References

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.