我有以下可嵌入的
@Data
@Embeddable
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class BaseEntity {
@CreatedDate
@Column(name = "created_date")
private LocalDateTime createdDate;
}
我把它嵌入了另一个实体
@Entity
@Data
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "room")
@Builder
public class room {
@Id
@GeneratedValue
private UUID id;
@JsonUnwrapped
@Embedded
private BaseEntity baseEntity;
@Column(length = 80, nullable = false)
private String name;
}
现在,当我保存一个文件室实体时,嵌入的baseentity为null,这就是为什么没有审计任何内容。根据https://docs.spring.io/spring-data/commons/docs/2.4.4/reference/html/#auditing.annotations 应该是这样的。我怎样才能纠正这种行为?
1条答案
按热度按时间fdbelqdn1#