-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMusic.java
More file actions
56 lines (45 loc) · 1.59 KB
/
Music.java
File metadata and controls
56 lines (45 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package umc.codeplay.domain;
import java.util.ArrayList;
import java.util.List;
import jakarta.persistence.*;
import lombok.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import umc.codeplay.domain.common.BaseEntity;
import umc.codeplay.domain.mapping.MusicLike;
@Entity
@Getter
@Builder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
public class Music extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
// TODO: 추후 BigInteger로 변환
private Long id;
@Column(nullable = false, length = 100)
private String title;
@Column(columnDefinition = "TEXT")
@Setter
private String musicUrl;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "member_id", nullable = false)
private Member member;
@OneToMany(mappedBy = "music", cascade = CascadeType.ALL)
@OnDelete(action = OnDeleteAction.CASCADE)
@JsonIgnore
private List<MusicLike> likeList = new ArrayList<>();
@OneToMany(mappedBy = "music", cascade = CascadeType.ALL)
@OnDelete(action = OnDeleteAction.CASCADE)
@JsonIgnore
private List<Harmony> harmonies = new ArrayList<>();
@OneToMany(mappedBy = "music", cascade = CascadeType.ALL)
@OnDelete(action = OnDeleteAction.CASCADE)
@JsonIgnore
private List<Track> tracks = new ArrayList<>();
@OneToMany(mappedBy = "music", cascade = CascadeType.ALL)
@OnDelete(action = OnDeleteAction.CASCADE)
@JsonIgnore
private List<Remix> remixes = new ArrayList<>();
}