Created
March 13, 2022 12:25
-
-
Save pranaybathini/34fd203ca84e60ed30f83d67775402a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.pranay.blog.entities.compositekey.UserPostId; | |
import lombok.AllArgsConstructor; | |
import lombok.Data; | |
import lombok.NoArgsConstructor; | |
import lombok.ToString; | |
import javax.persistence.*; | |
import java.io.Serializable; | |
@Data | |
@Entity | |
@Table(name = "user_post") | |
@AllArgsConstructor | |
@NoArgsConstructor | |
@IdClass(UserPostId.class) | |
public class UserPost implements Serializable { | |
private static final long serialVersionUID = -909206262878526790L; | |
@Id | |
@Column(name = "user_id") | |
private Integer userId; | |
@Id | |
@Column(name = "post_id") | |
private Integer postId; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lombok.Data; | |
import lombok.EqualsAndHashCode; | |
import lombok.NoArgsConstructor; | |
import java.io.Serializable; | |
@Data | |
@NoArgsConstructor | |
@EqualsAndHashCode | |
public class UserPostId implements Serializable { | |
private static final long serialVersionUID = 2702030623316532366L; | |
private Integer userId; | |
private Integer postId; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment