jpa-spring-data-kotlin-mapper

Detect Kotlin JPA pitfalls in Spring Data entities and repositories.

14|1|Updated Mar 6, 2026
One-click install
npx skills add https://github.com/yalishevant/kotlin-backend-agent-skills --skill jpa-spring-data-kotlin-mapper-yalishevant
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: jpa-spring-data-kotlin-mapper
Source: https://github.com/yalishevant/kotlin-backend-agent-skills/tree/main/.agents/skills/jpa-spring-data-kotlin-mapper
Command: npx skills add https://github.com/yalishevant/kotlin-backend-agent-skills --skill jpa-spring-data-kotlin-mapper-yalishevant

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Kotlin persistence code often suffers from incorrect entity design, lazy loading traps, and brittle repository queries that degrade performance and correctness.

Core Features & Use Cases

  • Clear entity design guidelines, anti-patterns to avoid, and practical examples for repositories and services.
  • Use cases include diagnosing N+1s, premature optimization, and maintaining correct equality semantics for Kotlin entities.

Quick Start

Apply these Kotlin JPA mapping rules to review and fix an entity and its repositories in your Spring Data project.

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

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

FAQPage Schema
Why does my Kotlin JPA entity throw a lazy loading exception outside of a transaction?

Kotlin JPA lazy loading fails when uninitialized Hibernate proxies are accessed outside an active transactional context. Apply explicit transactional boundaries and safe proxy compatibility checks to ensure relationships are fully initialized before session closure.

What is the best way to define equality semantics for Kotlin JPA entities?

Defining equality semantics for Kotlin JPA entities requires accounting for Hibernate proxy compatibility and nullability. Use consistent identifier-based equality rules rather than data class auto-generated methods to prevent data inconsistencies across detached and managed entity states.

How do I prevent N+1 query problems in Spring Data JPA repositories?

Prevent N+1 query problems in Spring Data JPA by applying proper fetch plans and reviewing entity relationship mappings. Diagnose premature optimization and adjust fetch types to ensure safe transactional access and avoid brittle repository queries.

Can I use Kotlin data classes for Hibernate entity mappings?

Using Kotlin data classes for Hibernate entity mappings introduces pitfalls because auto-generated equals and hashCode methods conflict with proxy compatibility. Apply explicit entity design guidelines to ensure proper nullability and avoid data inconsistencies in persistence code.

How do I configure proper nullability for Kotlin JPA entity relationships?

Configuring proper nullability for Kotlin JPA entity relationships involves applying design rules to entity shapes and relationship mappings. Ensure nullability aligns with Hibernate proxy compatibility and safe transactional access to prevent lazy loading issues.

What are the common pitfalls when mapping lazy-loaded relationships in Kotlin Spring Data?

Common pitfalls when mapping lazy-loaded relationships in Kotlin Spring Data include incorrect entity design, premature optimization, and brittle repository queries. Apply design rules to fetch plans and entity shapes to prevent data inconsistencies and ensure proxy compatibility.