Skip to content

Commit

Permalink
feat: #10 product entity
Browse files Browse the repository at this point in the history
  • Loading branch information
sominyun committed Mar 3, 2024
1 parent 1bffae0 commit 97a4c58
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 17 deletions.
4 changes: 4 additions & 0 deletions src/main/java/com/backend/soullive_a/entity/Age.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ public class Age {
@Column(name = "AGE_ID")
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "PRODUCT_ID", nullable = false)
private Product product;

@Enumerated(EnumType.STRING)
@Column(name = "AGE_TYPE")
private AgeType ageType;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/backend/soullive_a/entity/BrandImage.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public class BrandImage {
@Column(name = "BRAND_IMAGE_ID")
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "PRODUCT_ID", nullable = false)
private Product product;

@Column(name = "BRAND_IMAGE")
private String brandImage;
}
6 changes: 5 additions & 1 deletion src/main/java/com/backend/soullive_a/entity/Gender.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ public class Gender {
@Column(name = "GENDER_ID")
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "PRODUCT_ID", nullable = false)
private Product product;

@Enumerated(EnumType.STRING)
@Column(name = "GENDER")
@Column(name = "GENDER_TYPE")
private GenderType gender;
}
15 changes: 0 additions & 15 deletions src/main/java/com/backend/soullive_a/entity/Product.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,9 @@ public class Product {
@Column(name = "BRAND", length = 100)
private String brand;

@OneToMany(mappedBy = "PRODUCT")
private List<BrandImage> brandImages = new ArrayList<>();

@Column(name = "PRODUCT", length = 100)
private String product;

@Column(name = "CHARACTERISTIC")
private String characteristic;

@OneToMany(mappedBy = "PRODUCT_IMAGE")
private List<ProductImage> productImages = new ArrayList<>();

@OneToMany(mappedBy = "GENDER")
private List<Gender> genders = new ArrayList<>();

@OneToMany(mappedBy = "AGE")
private List<Age> ages = new ArrayList<>();

@OneToMany(mappedBy = "range")
private List<Range> ranges = new ArrayList<>();
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@
public class ProductImage {
@Id
@GeneratedValue
@Column(name = "PRODUCT_ID")
@Column(name = "PRODUCT_IMAGE_ID")
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "PRODUCT_ID", nullable = false)
private Product product;

@Column(name = "PRODUCT_IMAGE")
private String productImage;
}
4 changes: 4 additions & 0 deletions src/main/java/com/backend/soullive_a/entity/Range.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ public class Range {
@Column(name = "RANGE_ID")
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "PRODUCT_ID", nullable = false)
private Product product;

@Column(name = "RANGE")
private String rangeType;
}

0 comments on commit 97a4c58

Please sign in to comment.