-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from GDSC-Ewha-5th/LeeSeohyun
[이서현] 4주차 과제 - complete
- Loading branch information
Showing
5 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.example.serverstudy4.domain_leeseohyun; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Entity | ||
@Getter @Setter | ||
public class Blogpost { | ||
@Id | ||
@GeneratedValue | ||
@Column(name="blogpost_id") | ||
private Long id; //id | ||
private String title; //제목 | ||
private String content; //내용 | ||
private LocalDateTime timestamp; //포스팅된 당시의 시각 | ||
|
||
//Many 쪽에 외래키를 둔다. User, Category둘 다 대해 Many쪽임 | ||
@ManyToOne | ||
@JoinColumn(name="user_id") | ||
private User user; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "category_id") | ||
private Category category; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.example.serverstudy4.domain_leeseohyun; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
@Getter @Setter | ||
public class Category { | ||
@Id | ||
@GeneratedValue | ||
@Column(name="category_id") | ||
private Long id; //id | ||
private String category_name; //카테고리명 | ||
|
||
@OneToMany(mappedBy="category") //one 쪽이다 | ||
private List<Blogpost> blogposts = new ArrayList<>(); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.example.serverstudy4.domain_leeseohyun; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Entity | ||
@Getter @Setter | ||
public class Resume { | ||
@Id | ||
@GeneratedValue | ||
@JoinColumn(name="resume_id") | ||
private Long id; | ||
private String title; //제목 | ||
private String content; //내용 | ||
|
||
@ManyToOne //Many 쪽임 | ||
@JoinColumn(name="user_id") | ||
private User user; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.example.serverstudy4.domain_leeseohyun; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
@Getter | ||
@Setter | ||
public class User { | ||
|
||
@Id | ||
@GeneratedValue | ||
@Column(name="user_id") | ||
private Long id; //id | ||
private String name; //이름 | ||
private int age; //나이 | ||
private String country; //국가 | ||
private String city; //도시 | ||
private String postal_code; //우편번호 | ||
|
||
@OneToMany(mappedBy="user") //one 쪽이다 | ||
private List<Blogpost> blogposts = new ArrayList<>(); | ||
} |