diff --git a/core/core-domain/src/main/java/com/sponus/coredomain/domain/bookmark/Bookmark.java b/core/core-domain/src/main/java/com/sponus/coredomain/domain/bookmark/Bookmark.java index 123f3de6..45c50cdf 100644 --- a/core/core-domain/src/main/java/com/sponus/coredomain/domain/bookmark/Bookmark.java +++ b/core/core-domain/src/main/java/com/sponus/coredomain/domain/bookmark/Bookmark.java @@ -34,11 +34,11 @@ public class Bookmark extends BaseEntity { @Column(name = "bookmark_id") private Long id; - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "organization_id", foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT)) private Organization organization; - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "target_id", foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT)) private Organization target; } diff --git a/core/core-domain/src/main/java/com/sponus/coredomain/domain/organization/Organization.java b/core/core-domain/src/main/java/com/sponus/coredomain/domain/organization/Organization.java index b7ee7c74..1de6284d 100644 --- a/core/core-domain/src/main/java/com/sponus/coredomain/domain/organization/Organization.java +++ b/core/core-domain/src/main/java/com/sponus/coredomain/domain/organization/Organization.java @@ -1,10 +1,16 @@ package com.sponus.coredomain.domain.organization; +import java.util.ArrayList; +import java.util.List; + +import com.sponus.coredomain.domain.bookmark.Bookmark; import com.sponus.coredomain.domain.common.BaseEntity; import com.sponus.coredomain.domain.organization.enums.OrganizationType; import com.sponus.coredomain.domain.organization.enums.ProfileStatus; import com.sponus.coredomain.domain.organization.enums.Role; +import com.sponus.coredomain.domain.portfolio.PortfolioImage; +import jakarta.persistence.CascadeType; import jakarta.persistence.Column; import jakarta.persistence.DiscriminatorColumn; import jakarta.persistence.Entity; @@ -15,6 +21,7 @@ import jakarta.persistence.Id; import jakarta.persistence.Inheritance; import jakarta.persistence.InheritanceType; +import jakarta.persistence.OneToMany; import jakarta.persistence.Table; import lombok.AccessLevel; import lombok.AllArgsConstructor; @@ -75,6 +82,10 @@ public class Organization extends BaseEntity { @Column(name = "is_deleted") private boolean isDeleted; + @Builder.Default + @OneToMany(cascade = {CascadeType.ALL}) + private List bookmarks = new ArrayList<>(); + protected Organization( String name, String email,