@MappedSuperclass
3073 ワード
@Entityは実際のテーブルにマッピングされますが、@MappedSuperclassはテーブルにマッピングされません.
@MappedSuperclass
@Data
public abstract class BaseEntity {
private Date createdAt;
private Date updatedAt;
}
@Data
@Entity
@Table(name = "Users")
public class User extends BaseEntity{
}
public User(String name, UserTypeEnum userType, Date now) {
this.name = name;
this.userType = userType;
// this.createdAt = now;
// this.updatedAt = now;
super.setCreatedAt(now);
super.setUpdatedAt(now);
Reference
この問題について(@MappedSuperclass), 我々は、より多くの情報をここで見つけました https://velog.io/@yuo3ob/MappedSuperclassテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol