jpa-spring-data-kotlin-mapper

Design Kotlin JPA mappings for Hibernate and Spring Data JPA semantics.

302|22|Updated Feb 12, 2026
One-click install
npx skills add https://github.com/JetBrains/skills --skill jpa-spring-data-kotlin-mapper-jetbrains
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: jpa-spring-data-kotlin-mapper
Source: https://github.com/JetBrains/skills/tree/main/jpa-spring-data-kotlin-mapper
Command: npx skills add https://github.com/JetBrains/skills --skill jpa-spring-data-kotlin-mapper-jetbrains

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Helps Kotlin developers design and review persistence layers that work reliably with Hibernate and Spring Data JPA. It addresses issues like improper entity design, proxy behavior, and lazy loading pitfalls, reducing runtime surprises and data inconsistencies. It also helps avoid Kotlin-specific ORM bugs such as using data classes for entities and incorrect equals/hashCode implementations.

Core Features & Use Cases

  • Guidelines for entity design and separation between domain and persistence models.
  • Rules for identity, equality, fetch strategies, lazy loading, and proxies to prevent subtle bugs.
  • Practical patterns for diagnosing N+1, applying EntityGraph, JOIN FETCH, batch fetching, and projections.

Quick Start

Create a Kotlin JPA entity following the rules above and verify lazy loading behavior in a representative repository.

Frequently Asked Questions about jpa-spring-data-kotlin-mapper

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

FAQPage Schema
Why should I avoid Kotlin data classes for JPA entity design?

Avoiding data classes for JPA entities prevents Hibernate proxy generation failures and incorrect equals/hashCode behavior. Regular classes with explicit identity rules ensure safe lazy loading and reliable proxy handling.

How do I fix lazy loading and N+1 query issues in Spring Data JPA?

Fix lazy loading and N+1 query issues in Spring Data JPA by applying EntityGraph, JOIN FETCH, batch fetching, and projections. These patterns optimize fetch strategies to reduce unnecessary database round trips.

How do I handle nullability and transaction boundaries with Kotlin JPA?

Handle nullability and transaction boundaries in Kotlin JPA by enforcing safe proxy handling and explicit transaction scopes. This prevents LazyInitializationException runtime errors and maintains consistent entity state.

What is the best way to separate domain and persistence models in Kotlin?

The best way to separate domain and persistence models in Kotlin is applying distinct mapping guidelines for entities and repositories. This separation enforces safe identity, fetch, and equality rules while preventing ORM semantic leaks.

Does Hibernate lazy loading work correctly with Kotlin nullable types?

Hibernate lazy loading conflicts with Kotlin nullable types when uninitialized proxies bypass nullability checks. Safe entity design requires explicit proxy handling and documented fetch rules to avoid unexpected null behavior.

When should I use JOIN FETCH vs EntityGraph for batch fetching in Spring Data JPA?

Use JOIN FETCH for simple query-level batch fetching and EntityGraph for dynamic, reusable fetch profiles in Spring Data JPA. Choosing correctly optimizes lazy loading and resolves N+1 query issues across typical use cases.