JPA Entity複合キーの設定


エンドセクション
import lombok.*;

import javax.persistence.*;
import java.util.Date;

@Entity
@Getter
@Setter
@ToString
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name="group_info")
@IdClass(GroupInfoId.class)
public class group_info {

    @Id
    @Column(name="mall_no")
    String mallNo;

    @Id
    @Column(name = "group_nm")
    String groupNm;

    @Column(name="register_date", columnDefinition="DATETIME")
    @Temporal(TemporalType.TIMESTAMP)
    Date registerDate;

    @Column(name="update_date", columnDefinition="DATETIME")
    @Temporal(TemporalType.TIMESTAMP)
    Date updateDate;


}
ふくごうキーぶ
@Getter
@Setter
@Embeddable
public class GroupInfoId implements Serializable {

    @Column(name="mall_no")
    String mallNo;

    @Column(name = "group_nm")
    String groupNm;
}