> 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)
curl "https://skillshub.wtf/HoangNguyen0403/agent-skills-standard/spring-boot-data-access?format=md"Spring Boot Data Access
Priority: P0
Implementation Guidelines
JPA & Hibernate
- Read-Only: Default to
@Transactional(readOnly = true)on Services. Override only on write methods. - Projections: Use Java Records for read-only queries. Avoid fetching full Entities.
- Pagination: ALWAYS use
Pageablefor collections. - Open-In-View: Set
spring.jpa.open-in-view=falseto detect lazy loading issues early.
Query Optimization
- N+1 Problem: Use
JOIN FETCH(JPQL) or@EntityGraphfor relationships. - Bulk Operations: Use
@Modifyingfor batch updates/deletes to bypass Entity overhead.
Anti-Patterns
- N+1 Selects:
**No loops in loops**: Fetch eagerly or use graphs. - Logic in Queries:
**No complex JPQL**: Use Service logic. - Returning Streams:
**No raw Streams**: Use Lists or Page.
References
> related_skills --same-repo
> typescript-tooling
Development tools, linting, and build config for TypeScript. Use when configuring ESLint, Prettier, Jest, Vitest, tsconfig, or any TS build tooling. (triggers: tsconfig.json, .eslintrc.*, jest.config.*, package.json, eslint, prettier, jest, vitest, build, compile, lint)
> typescript-security
Secure coding practices for TypeScript. Use when validating input, handling auth tokens, sanitizing data, or managing secrets and sensitive configuration. (triggers: **/*.ts, **/*.tsx, validate, sanitize, xss, injection, auth, password, secret, token)
> typescript-language
Modern TypeScript standards for type safety and maintainability. Use when working with types, interfaces, generics, enums, unions, or tsconfig settings. (triggers: **/*.ts, **/*.tsx, tsconfig.json, type, interface, generic, enum, union, intersection, readonly, const, namespace)
> typescript-best-practices
Idiomatic TypeScript patterns for clean, maintainable code. Use when writing or refactoring TypeScript classes, functions, modules, or async logic. (triggers: **/*.ts, **/*.tsx, class, function, module, import, export, async, promise)