데이터베이스 커넥션

@NonNull
@Nullable
User user3 = User.builder() .name("martin") .email("kimziou77@NAVER.COM") .build();
@Entity @EntityListeners(value = UserEntityListener.class) @Table(name = "user", indexes = {@Index(columnList = "name")}, uniqueConstraints = {@UniqueConstraint(columnNames = {"email"})}) public class User extends BaseEntity{ @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @NonNull private String name; @NonNull private String email; @Enumerated(value = EnumType.STRING) private Gender gender; @OneToMany(fetch = FetchType.EAGER) @JoinColumn(name = "user_id", insertable =false, updatable = false) @ToString.Exclude private List<UserHistory> userHistories = new ArrayList<>(); @OneToMany @JoinColumn(name = "user_id") @ToString.Exclude private List<Review> reviews = new ArrayList<>(); }
@MappedSuperclass @EntityListeners(value = AuditingEntityListener.class) public class BaseEntity implements Auditable { @CreatedDate private LocalDateTime createdAt; @LastModifiedDate private LocalDateTime updatedAt; }
dateTime 포멧 참고 > https://suyou.tistory.com/287