jpa-rules

Enforce standardized JPA entity mapping rules for base inheritance, enum strings, and associations.

Updated Jan 11, 2026
One-click install
npx skills add https://github.com/gykk16/spring-skeleton --skill jpa-rules
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: jpa-rules
Source: https://github.com/gykk16/spring-skeleton/tree/main/.omc/skills/jpa-rules
Command: npx skills add https://github.com/gykk16/spring-skeleton --skill jpa-rules

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides clear, actionable guidelines to ensure consistent and maintainable JPA entity mapping, preventing common pitfalls and promoting best practices in database interactions.

Core Features & Use Cases

  • Entity Mapping Standards: Defines rules for extending base entities, enum mapping, and association policies.
  • Fetch Strategy Guidance: Recommends LAZY fetching and provides solutions for lazy loading issues.
  • Locking Strategies: Explains optimistic and pessimistic locking with examples.
  • Use Case: When developing new entities, developers can consult this Skill to ensure they adhere to the project's established patterns for auditing, associations, and fetching, leading to more predictable and performant data access.

Quick Start

Follow the jpa-rules skill to ensure your new entity correctly extends BaseEntity and uses LAZY fetching for all associations.

Frequently Asked Questions about jpa-rules

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

FAQPage Schema
How do I enforce standardized JPA entity mapping rules for base entity inheritance and enums?

JPA entity mapping rules enforce base entity inheritance, enum string mapping, and unidirectional associations. Following these standardized guidelines ensures consistent database interactions and maintainable entity structures across your project.

How do I resolve N+1 queries and OSIV issues in Hibernate?

To resolve N+1 queries and OSIV issues in Hibernate, apply standardized entity mapping rules and fetch strategy guidance. These rules recommend LAZY fetching and provide specific solutions for lazy loading pitfalls.

What is the best way to configure fetch strategies for JPA associations?

The best way to configure fetch strategies is using LAZY fetching for all JPA associations. This approach provides predictable data access performance and includes targeted solutions for common lazy loading issues.

When should I use optimistic vs pessimistic locking for JPA entity state management?

Locking strategies for JPA entity state management depend on concurrency needs. Standardized rules explain when to use optimistic and pessimistic locking with examples to prevent concurrent transaction conflicts.

Do I need to follow specific association policies when creating new JPA entities?

Yes, new JPA entities must follow unidirectional association policies. Adhering to these established patterns for associations, auditing, and fetching ensures predictable and performant data access.

Can I use Kotlin with these JPA entity mapping standards?

Yes, you can use Kotlin with these JPA entity mapping standards. The guidelines support Kotlin environments to enforce robust entity mapping, base entity inheritance, and standardized database interactions.