-
Notifications
You must be signed in to change notification settings - Fork 0
상속받은 클래스의 attribute가 저장되지 않을 때
Lucy Oh edited this page Aug 10, 2023
·
1 revision
Written By Jisoo Oh
BaseEntity의 attribute들이 BaseEntity를 상속받은 엔티티들을 저장할 때, 반영되지 않음.
@Getter
@Setter //Setters are used in aws-dynamodb-sdk
@NoArgsConstructor
public class BaseEntity {
@CreatedDate
@DynamoDBAttribute
@DynamoDBTypeConverted(converter = LocalDateTimeConverter.class)
private LocalDateTime createdDate;
@LastModifiedDate
@DynamoDBAttribute
@DynamoDBTypeConverted(converter = LocalDateTimeConverter.class)
private LocalDateTime lastModifiedDate;
@DynamoDBTypeConvertedEnum
@DynamoDBAttribute
private Status status = Status.PRIVATE; // default
}
DynamoDBMapper에 해당 속성 역시도 직렬화serialize
해야 함을 알려야 함.
- BaseEntity위에
@DynamoDBDocument
를 사용하여 알려줌!
@Getter
@Setter
@NoArgsConstructor
@DynamoDBDocument // add this
public class BaseEntity {
@CreatedDate
@DynamoDBAttribute
@DynamoDBTypeConverted(converter = LocalDateTimeConverter.class)
private LocalDateTime createdDate;
@LastModifiedDate
@DynamoDBAttribute
@DynamoDBTypeConverted(converter = LocalDateTimeConverter.class)
private LocalDateTime lastModifiedDate;
@DynamoDBTypeConvertedEnum
@DynamoDBAttribute
private Status status = Status.PRIVATE; // default
}