-
Notifications
You must be signed in to change notification settings - Fork 0
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 #19 from KAKAO-TOUR-API-CONTEST/develop
[FEAT] album, photos entity mapping
- Loading branch information
Showing
3 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
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.ai_jeju.domain; | ||
|
||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
|
||
@Table(name="album") | ||
@NoArgsConstructor(access= AccessLevel.PROTECTED) //기본생성자 | ||
@Getter | ||
@Entity | ||
@AllArgsConstructor // 모든 필드를 초기화하는 생성자 | ||
@Builder // 빌더 패턴 | ||
public class Album { | ||
|
||
@Id | ||
@OneToOne | ||
@JoinColumn(name = "album_id") // FK를 설정 | ||
private Child child; | ||
|
||
} |
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,25 @@ | ||
package com.example.ai_jeju.domain; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
|
||
@Table(name="photos") | ||
@NoArgsConstructor(access= AccessLevel.PROTECTED) //기본생성자 | ||
@Getter | ||
@Entity | ||
@AllArgsConstructor // 모든 필드를 초기화하는 생성자 | ||
@Builder // 빌더 패턴 | ||
public class Photo { | ||
|
||
@Id | ||
@Column(name = "photo_id") | ||
private Long photoId; | ||
|
||
@Column(name = "img_src") | ||
private String imgSrc; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "album_id") | ||
private Album album; | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/example/ai_jeju/repository/AlbumRepository.java
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,13 @@ | ||
package com.example.ai_jeju.repository; | ||
|
||
import com.example.ai_jeju.domain.Album; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.Optional; | ||
|
||
@Repository | ||
public interface AlbumRepository extends JpaRepository<Album, Long> { | ||
|
||
|
||
} |