Improve Repo Entities once again

This commit is contained in:
Tim
2025-05-23 16:36:02 +02:00
parent 4342c7937b
commit 509cf85dcb
3 changed files with 9 additions and 4 deletions

View File

@@ -8,6 +8,7 @@ import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import java.util.List;
import java.util.UUID; import java.util.UUID;
@Getter @Getter
@@ -46,4 +47,7 @@ public class Article {
@Column(name = "category", nullable = false) @Column(name = "category", nullable = false)
private String category; private String category;
@OneToMany(mappedBy = "articleId", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
private List<ArticleConfiguration> configurationList;
} }

View File

@@ -21,10 +21,6 @@ public class ArticleConfiguration {
@Column(name = "id", nullable = false) @Column(name = "id", nullable = false)
private Long id; private Long id;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "articleId", referencedColumnName = "id", nullable = false)
private Article article;
@Column(name = "name", nullable = false) @Column(name = "name", nullable = false)
private String name; private String name;
} }

View File

@@ -2,6 +2,8 @@ package de.htwsaar.webshop.repository.entities;
import jakarta.persistence.*; import jakarta.persistence.*;
import java.util.List;
@Entity @Entity
@Table(name = "Orders") @Table(name = "Orders")
public class Order { public class Order {
@@ -15,4 +17,7 @@ public class Order {
@Column(name = "time") @Column(name = "time")
private Long time; private Long time;
@OneToMany(mappedBy = "orderId")
private List<OrderItem> orderItems;
} }