작성
·
94
0
@Getter @Setter @NoArgsConstructor(access = AccessLevel.PUBLIC) @Entity @Table(name = "TB_MANAGER") @DynamicInsert @DynamicUpdate @JsonInclude(JsonInclude.Include.NON_EMPTY) public class Manager { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "MANAGER_KEY") @ApiModelProperty(value = "관리자 시퀀스", hidden = true, name = "managerKey") private Long managerKey; @Column(name = "MANAGER_ID") @ApiModelProperty(value = "관리자 아이디", name = "managerId") private String managerId; @Column(name = "PASSWORD") @ApiModelProperty(value = "비밀번호", name = "password") @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) private String password; @Column(name = "NAME") @ApiModelProperty(value = "이름", name = "name") private String name; @OneToOne(fetch = FetchType.EAGER) @JoinColumn(name = "MANAGER_KEY") private ManagerSub managerSub; } @Getter @NoArgsConstructor(access = AccessLevel.PUBLIC) @Entity @Table(name = "TB_MANAGER_SUB") @DynamicInsert @DynamicUpdate @JsonInclude(JsonInclude.Include.NON_EMPTY) public class ManagerSub { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "MANAGER_SUB_KEY") @ApiModelProperty(value = "zzz", hidden = true, name = "managerSubKey") private Long managerSubKey; @Column(name = "MANAGER_KEY") private Long managerKey; @Column(name = "COUNT") @ApiModelProperty(value = "수", name = "count") private Long count; @Column(name = "PHONE") @ApiModelProperty(value = " 전화번호", name = "phone") private String phone; @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "MANAGER_KEY", insertable = false, updatable = false) private Manager manager; }
답변