Skip to content

Commit

Permalink
[Feat] 양방향 참조를 위한 onetomany 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
luna156 committed Nov 24, 2024
1 parent 4ee0727 commit 5a8c9c0
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Entity
@Table(name = "application")
@Data
Expand All @@ -28,6 +30,6 @@ public class Application extends DataEntity {
@JoinColumn(name = "applicant_id")
private Applicant applicant;



@OneToMany(mappedBy = "application", orphanRemoval = true, cascade = CascadeType.ALL)
private List<Response> responseList;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;


@Entity
@Table(name = "form")
Expand All @@ -28,4 +30,7 @@ public class Form extends DataEntity {

private String title;
private String description;

@OneToMany(mappedBy = "form", orphanRemoval = true, cascade = CascadeType.ALL)
private List<Question> questionList;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.List;

@Entity
@Table(name = "meeting_time")
Expand Down Expand Up @@ -37,4 +38,7 @@ public class MeetingTime extends DataEntity {
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "recruiting_id")
private Recruiting recruiting;

@OneToMany(mappedBy = "meeting_time", orphanRemoval = true, cascade = CascadeType.ALL)
private List<Application> applicationList;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@

import com.likelion.innerjoin.common.entity.DataEntity;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;


@Entity
@Table(name = "images")
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class PostImage extends DataEntity {

@Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Entity
@Table(name = "recruiting")
@Data
Expand All @@ -28,4 +30,7 @@ public class Recruiting {

@Column(name = "job_title")
private String jobTitle;

@OneToMany(mappedBy = "recruiting", orphanRemoval = true, cascade = CascadeType.ALL)
private List<Application> application;
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package com.likelion.innerjoin.user.model.entity;

import com.likelion.innerjoin.common.entity.DataEntity;
import com.likelion.innerjoin.post.model.entity.Application;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Entity
@Table(name = "applicant")
@Data
Expand All @@ -32,4 +35,7 @@ public class Applicant extends DataEntity {
private String major;
@Column(name = "phone_number")
private String phoneNum;

@OneToMany(mappedBy = "applicant", orphanRemoval = true, cascade = CascadeType.ALL)
private List<Application> applicationList;
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package com.likelion.innerjoin.user.model.entity;

import com.likelion.innerjoin.common.entity.DataEntity;
import com.likelion.innerjoin.post.model.entity.Form;
import com.likelion.innerjoin.post.model.entity.Post;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;


@Entity
@Table(name = "club")
Expand All @@ -31,4 +35,9 @@ public class Club extends DataEntity {
@Column(name = "cate_list")
private String categoryList;

@OneToMany(mappedBy = "club", orphanRemoval = true, cascade = CascadeType.ALL)
private List<Post> postList;

@OneToMany(mappedBy = "club", orphanRemoval = true, cascade = CascadeType.ALL)
private List<Form> formList;
}

0 comments on commit 5a8c9c0

Please sign in to comment.