Kotlin Backend Jpa Entity Mapping
Kotlin JPA entity guidance that replaces data classes with identity-safe classes, uniqueness constraints, and fetch plans.
- CCM score
- 77 of 100
- skills.sh installs
- 1.9K
- GitHub stars
- 1.1K
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers entity design, identity and equality, uniqueness constraints, relationships, fetch plans, and common Kotlin-specific ORM traps
- Enforces regular classes instead of
data classfor entities, with ID-basedequals, a stablehashCode, andtoStringthat avoids lazy relations - Pairs database uniqueness constraints with application-level guards so duplicate reservations fail cleanly and races are still caught
- Designed for Kotlin backend teams using Spring Data JPA and Hibernate when creating or reviewing entities, diagnosing N+1 issues, or placing indexes
Install
$ npx -y skills add kotlin/kotlin-agent-skills --skill kotlin-backend-jpa-entity-mapping -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
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 classfor JPA entities. Use a regularclass. Keepdata classfor 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
lateinitonly 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
Details
- Repository
- github.com/kotlin/kotlin-agent-skills
- Categories
- Java & JVM, Databases
- First seen
- Jun 3, 2026
Questions
What does the kotlin-backend-jpa-entity-mapping skill do?
It guides an agent to model Kotlin persistence code correctly for Spring Data JPA and Hibernate, covering entity design, identity and equality, uniqueness constraints, relationships and fetch plans. It also helps prevent Kotlin-specific ORM bugs such as data class entities with broken equals and hashCode, and diagnoses N+1 queries and LazyInitializationException.
Where does this skill rank in its category?
It sits in the Java & JVM category on Claude Marketplaces and ranks in the top 50 there. Other skills in the category include java-springboot, springboot-patterns, java-coding-standards, jpa-patterns and kotlin-patterns.
How do I install the kotlin-backend-jpa-entity-mapping skill?
Run npx -y skills add kotlin/kotlin-agent-skills --skill kotlin-backend-jpa-entity-mapping -y in your project. Once installed, the agent follows its rules when creating or reviewing JPA entities.
Why shouldn't I use a data class for a JPA entity?
A data class generates equals and hashCode from all fields, which breaks Set and Map membership after an entity's state changes. Its copy function can also create detached duplicates of managed entities. This skill tells the agent to use a regular class with ID-based identity instead.
More from kotlin/kotlin-agent-skills
All 5Similar to Kotlin Backend Jpa Entity Mapping
More Java & JVMjava-jpa-hibernateSkillpluginagentmarketplace/custom-plugin-java627 installsProduction-ready JPA and Hibernate guidance covering entity design, N+1 prevention, transactions, and caching.
spring-data-jpaSkillgiuseppe-trisciuoglio/developer-kit4.4K installsSpring Data JPA repository, entity, query, and transaction patterns with guardrails against N+1 queries and EAGER fetching.
kotlin-springbootSkillgithub/awesome-copilot9.8K installsBest-practices guide for Spring Boot services written in Kotlin, covering setup, injection, data, and testing.
412-frameworks-quarkus-panachePluginjabrena/plinth467 starsUse when you need data access with Quarkus Hibernate ORM Panache — including PanacheEntity / PanacheEntityBase, PanacheRepository, named queries, JPQL, native S
144-java-data-oriented-programmingSkilljabrena/plinth398 installsJava refactoring guide that separates records and immutable data from pure transformation and validation functions.