Skip to content

Commit

Permalink
feat: SurveyAnswer Entity 생성 (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
isieun0908 committed Mar 16, 2023
1 parent b8dde25 commit bd508da
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package devteamOne.classmate.surveyAnswer.domain;

import devteamOne.classmate.survey.domain.Survey;
import devteamOne.classmate.surveyOption.domain.SurveyOption;
import devteamOne.classmate.user.domain.User;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.Id;
import jakarta.persistence.IdClass;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;

@Entity
@IdClass(SurveyAnswerId.class)
public class SurveyAnswer {

@Id
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id")
private User user;

@Id
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "survey_id")
private Survey survey;

@Id
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "survey_option_id")
private SurveyOption surveyOption;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package devteamOne.classmate.surveyAnswer.domain;

import devteamOne.classmate.survey.domain.Survey;
import devteamOne.classmate.surveyOption.domain.SurveyOption;
import devteamOne.classmate.user.domain.User;
import java.io.Serializable;

public class SurveyAnswerId implements Serializable {
private User user;
private Survey survey;
private SurveyOption surveyOption;
}

0 comments on commit bd508da

Please sign in to comment.