Kotlin Backend Jpa Entity Mapping

Model Kotlin persistence code correctly for Spring Data JPA and Hibernate. Covers entity design, identity and equality, uniqueness constraints, relationships, fetch plans, and common ORM (Object-Relational Mapping) traps specific to Kotlin. Use when creating or reviewing JPA (Java Persistence API) entities, diagnosing N+1 or LazyInitializationException, placing indexes and uniqueness rules, or preventing Kotlin-specific bugs such as data class entities and broken equals/hashCode.

398 stars 35 forksMobile Development

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add JetBrains/skills --skill kotlin-backend-jpa-entity-mapping
Manual install
git clone --depth 1 https://github.com/JetBrains/skills.git /tmp/skills
mkdir -p ~/.claude/skills
cp -r /tmp/skills/kotlin-backend-jpa-entity-mapping ~/.claude/skills/kotlin-backend-jpa-entity-mapping

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# JPA Entity Mapping for Kotlin

Kotlin's `data class` is natural for DTOs but dangerous for JPA entities. Hibernate relies on
identity semantics that `data class` breaks: `equals`/`hashCode` over all fields corrupts
`Set`/`Map` membership after state changes, and auto-generated `copy()` creates detached
duplicates of managed entities.

This skill teaches correct entity design, identity strategies, and uniqueness constraints
for Kotlin + Spring Data JPA projects.

## Entity Design Rules

- **Never use `data class` for JPA entities.** Use a regular `class`. Keep `data class` for DTOs.
- Keep transport DTOs and persistence entities separate unless the project clearly uses a shared model.
- Model required columns as non-null only when object construction and persistence lifecycle make it safe.
- Use `lateinit` only when the project already accepts that tradeoff and the lifecycle is safe.
- Verify `kotlin("plugin.jpa")` or equivalent no-arg support when JPA entities exist.
- Verify classes and members are compatible with proxying where needed.

## Identity and Equality

- Never accept all-field `equals`/`hashCode` generated by `data class` on an entity.
- Follow project conventions when they already define an identity strategy.
- If no convention exists, use ID-based equality with a stable `hashCode`.
- Be explicit about mutable fields and lazy associations when discussing equality.

### Broken: `data class` Entity
Read the full skill on GitHub

Details

Skill name
kotlin-backend-jpa-entity-mapping
Path
kotlin-backend-jpa-entity-mapping/SKILL.md
Repo updated
21 October 2026

FAQ

What does the Kotlin Backend Jpa Entity Mapping skill do?

Model Kotlin persistence code correctly for Spring Data JPA and Hibernate. Covers entity design, identity and equality, uniqueness constraints, relationships, fetch plans, and common ORM (Object-Relational Mapping) traps specific to Kotlin. Use when creating or reviewing JPA (Java Persistence API) entities, diagnosing N+1 or LazyInitializationException, placing indexes and uniqueness rules, or preventing Kotlin-specific bugs such as data class entities and broken equals/hashCode.

How do I install the Kotlin Backend Jpa Entity Mapping skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add JetBrains/skills --skill kotlin-backend-jpa-entity-mapping. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Kotlin Backend Jpa Entity Mapping popular?

It lives in JetBrains/skills, which has 398 GitHub stars and 35 forks.

Related skills

Deploy to Vercel

398

JetBrains/skills

Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".

DevOps & CloudIn 2 lists35

Vercel React Native Skills

398

JetBrains/skills

React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.

Mobile DevelopmentIn 2 lists35

Vitest

398

JetBrains/skills

Vitest fast unit testing framework powered by Vite with Jest-compatible API. Use when writing tests, mocking, configuring coverage, or working with test filtering and fixtures.

Testing & QA35

Kotlin Spring Proxy Compatibility

398

JetBrains/skills

Diagnose and prevent Kotlin plus Spring proxy failures around `@Transactional`, `@Cacheable`, `@Async`, method security, retry, configuration proxies, and JPA entity requirements. Use when AOP annotations appear to do nothing, transactional or cache behavior is inconsistent, compiler plugins may be missing, self-invocation is suspected, or Kotlin final-by-default semantics may break Spring behavior.

Mobile Development35

Jpa Spring Data Kotlin Mapper

398

JetBrains/skills

Model Kotlin persistence code correctly for Spring Data JPA and Hibernate, including entity design, relationships, fetch plans, repository queries, lazy loading, and common performance traps. Use when creating or reviewing entities and repositories, diagnosing N+1 or `LazyInitializationException`, placing indexes and uniqueness rules, or preventing Kotlin-specific ORM bugs such as `data class` entities and broken `equals` or `hashCode`.

Mobile Development35

Kotlin Tooling Agp9 Migration

398

JetBrains/skills

Migrates Kotlin Multiplatform (KMP) projects to Android Gradle Plugin 9.0+. Handles plugin replacement (com.android.kotlin.multiplatform.library), module splitting, DSL migration, and the new default project structure. Use when upgrading AGP, when build fails due to KMP+AGP incompatibility, or when the user mentions AGP 9.0, android multiplatform plugin, KMP migration, or com.android.kotlin.multiplatform.library.

Mobile Development35

Browse the most popular Claude skills, all mobile development skills, or write your own with the skills generator.