spring-persistence

Generate Spring Data persistence code with JPA entities, repositories, Flyway migrations, and Redis caching.

Updated Feb 25, 2026
One-click install
npx skills add https://github.com/zenobiuszeto/banking-strawman-capabilities --skill spring-persistence
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: spring-persistence
Source: https://github.com/zenobiuszeto/banking-strawman-capabilities/tree/main/skills/spring-persistence
Command: npx skills add https://github.com/zenobiuszeto/banking-strawman-capabilities --skill spring-persistence

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It removes the guesswork and risk when building production-ready persistence layers by providing clear, secure patterns for JPA entities, repositories, schema migrations, caching, and document-store integration so teams avoid common pitfalls like incorrect mappings, N+1 queries, and unsafe migrations.

Core Features & Use Cases

  • JPA entity design with recommended annotations, UUID id generation, optimistic locking, and database-safe enums to ensure reliable domain modeling.
  • Spring Data repositories & specifications including derived queries, JPQL, projections, pessimistic locks for balance updates, and dynamic filtering for pageable APIs.
  • Flyway migration guidance and naming conventions to maintain safe, sequential schema evolution in CI/CD.
  • MongoDB audit/event document patterns and Redis caching best practices for audit stores and read-performance with Cacheable/CacheEvict semantics.
  • MapStruct mapping patterns and practical advice to avoid exposing entities across boundaries and to keep mappers build-strict.

Quick Start

Generate production-ready JPA entity, Spring Data repository with specifications, Flyway migration, MapStruct mapper, and Redis cache configuration for an Account aggregate with optimistic locking and database indexes.

Frequently Asked Questions about spring-persistence

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

FAQPage Schema
How do I prevent N+1 queries and implement optimistic locking in Spring Data JPA?

To prevent N+1 queries and implement optimistic locking in Spring Data JPA, use proper entity mappings and the @Version annotation. This Skill provides production-ready patterns for JPA entities, derived queries, and specifications to ensure reliable domain modeling and safe concurrent transactions.

What is the best way to manage sequential schema migrations with Flyway in a Spring Boot application?

The best way to manage sequential schema migrations with Flyway in a Spring Boot application is to follow strict naming conventions and sequential migration guidance. This ensures safe schema evolution in CI/CD pipelines while avoiding unsafe database updates and mapping inconsistencies.

How do I configure Redis caching and MapStruct mappers in a Spring persistence layer?

To configure Redis caching and MapStruct mappers in a Spring persistence layer, apply Cacheable/CacheEvict semantics and build-strict mapper patterns. This approach optimizes read-performance and prevents exposing JPA entities directly across service boundaries.

Does this Spring persistence approach support MongoDB for audit logs alongside JPA?

Yes, this Spring persistence approach supports MongoDB for audit logs alongside JPA. It provides specific audit and event document patterns for MongoDB, allowing you to maintain transactional data in JPA while storing audit logs in a separate document store.

How do I model banking backend aggregates using Hibernate 6 and Spring Data?

To model banking backend aggregates using Hibernate 6 and Spring Data, apply JPA mappings with UUID id generation, database-safe enums, and pessimistic locks for balance updates. This ensures reliable transactional domain modeling for banking and similar financial services.