spring-data-jpa

Solid

Use when generating or refactoring Spring Boot 4 JPA entities, repositories, queries, projections, persistence tests, entity relationships, embeddables, IDs, or Hibernate mappings. Covers Jakarta Persistence 3.2 imports, Hibernate 7 entity modeling, new-state detection, N+1 prevention, projections, keyset pagination, batch writes, and common agent mistakes.

AI & Automation 225 stars 37 forks Updated 6 days ago MIT

Install

View on GitHub

Quality Score: 88/100

Stars 20%
78
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Spring Data JPA (Boot 4 / Hibernate 7) Spring Boot 4 manages Jakarta Persistence 3.2, Jakarta Validation 3.1, and Hibernate ORM 7.x. Use Boot dependency management and import `jakarta.persistence.*` / `jakarta.validation.*`. Do not add explicit Hibernate, JPA, or Validator versions unless the project has a deliberate override policy. ## Entity Model Rules Use an `@Entity` only for persistent state with identity and lifecycle. Use records for DTOs, commands, and read models. Use `@Embeddable` for values stored inside an entity table. ```java @Entity @Table(name = "orders", indexes = { @Index(name = "idx_orders_customer_id", columnList = "customer_id"), @Index(name = "idx_orders_status_created", columnList = "status, created_at") }) @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) public class Order { @Id @GeneratedValue(strategy = GenerationType.UUID) @Column(nullable = false, updatable = false) private UUID id; @Version private Long version; @Column(name = "customer_id", nullable = false, updatable = false) private UUID customerId; @Enumerated(EnumType.STRING) @Column(nullable = false, length = 32) private OrderStatus status; @Embedded private Money total; @OneToMany(mappedBy = "order", cascade = CascadeType.ALL, orphanRemoval = true) private List<OrderItem> items = new ArrayList<>(); @CreationTimestamp @Column(name = "created_at", nullable = false, updatable = false) privat...

Details

Author
rrezartprebreza
Repository
rrezartprebreza/spring-boot-skills
Created
4 months ago
Last Updated
6 days ago
Language
Java
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category