1
0

refactor(jpa): 使用 @Column 替换 @Comment 注解

This commit is contained in:
2026-01-06 15:49:55 +08:00
parent 8a944923ea
commit d38196cb6e
2 changed files with 5 additions and 5 deletions

View File

@@ -1,5 +1,6 @@
package com.lanyuanxiaoyao.service.template.jpa.entity; package com.lanyuanxiaoyao.service.template.jpa.entity;
import jakarta.persistence.Column;
import jakarta.persistence.EntityListeners; import jakarta.persistence.EntityListeners;
import jakarta.persistence.Id; import jakarta.persistence.Id;
import jakarta.persistence.MappedSuperclass; import jakarta.persistence.MappedSuperclass;
@@ -7,7 +8,6 @@ import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.ToString; import lombok.ToString;
import lombok.experimental.FieldNameConstants; import lombok.experimental.FieldNameConstants;
import org.hibernate.annotations.Comment;
import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.data.jpa.domain.support.AuditingEntityListener;
/** /**
@@ -43,6 +43,6 @@ public class IdOnlyEntity {
*/ */
@Id @Id
@SnowflakeId @SnowflakeId
@Comment("记录唯一标记") @Column(comment = "记录唯一标记")
private Long id; private Long id;
} }

View File

@@ -1,5 +1,6 @@
package com.lanyuanxiaoyao.service.template.jpa.entity; package com.lanyuanxiaoyao.service.template.jpa.entity;
import jakarta.persistence.Column;
import jakarta.persistence.EntityListeners; import jakarta.persistence.EntityListeners;
import jakarta.persistence.MappedSuperclass; import jakarta.persistence.MappedSuperclass;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@@ -7,7 +8,6 @@ import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.ToString; import lombok.ToString;
import lombok.experimental.FieldNameConstants; import lombok.experimental.FieldNameConstants;
import org.hibernate.annotations.Comment;
import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.data.jpa.domain.support.AuditingEntityListener;
@@ -45,7 +45,7 @@ public class SimpleEntity extends IdOnlyEntity {
* </p> * </p>
*/ */
@CreatedDate @CreatedDate
@Comment("记录创建时间") @Column(comment = "记录创建时间")
private LocalDateTime createdTime; private LocalDateTime createdTime;
/** /**
@@ -55,6 +55,6 @@ public class SimpleEntity extends IdOnlyEntity {
* </p> * </p>
*/ */
@LastModifiedDate @LastModifiedDate
@Comment("记录更新时间") @Column(comment = "记录更新时间")
private LocalDateTime modifiedTime; private LocalDateTime modifiedTime;
} }