Springboot Jpa Entity Class Conventions

为实体类设计设定标准,包括用于数据库交互的注解、ID 生成策略和关系配置。

liaosw97 Updated

File contents

  • 必须使用 @Entity 注解实体类。
  • 必须使用 @Data (来自 Lombok) 注解实体类,除非在提示中另有说明。
  • 必须使用 @Id 和 @GeneratedValue(strategy=GenerationType.IDENTITY) 注解实体 ID。
  • 必须对关系使用 FetchType.LAZY,除非在提示中另有说明。
  • 根据最佳实践正确注解实体属性,例如 @Size, @NotEmpty, @Email 等。

liaosw97/awesome-rules-skills/tree/main/plugins/springboot/skills/springboot-jpa-entity-class-conventions commit 7e066d895f

Frequently asked questions

npx skillmds@latest add liaosw97/springboot-jpa-entity-class-conventions