Skip to content
Snippets Groups Projects
Commit 8ba757e6 authored by Birk Øvstetun Narvhus's avatar Birk Øvstetun Narvhus
Browse files

hot fixed product frige asso and product, to fix json mappign

parent 8fd5fcaa
No related branches found
No related tags found
No related merge requests found
package ntnu.idatt2016.v233.SmartMat.entity.fridgeProduct;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
......@@ -21,12 +22,14 @@ public class FridgeProductAsso {
@ManyToOne
@MapsId("fridge_id")
@JoinColumn(name = "fridge_id")
@JsonIgnoreProperties({"products"})
private Fridge fridgeId;
@Id
@ManyToOne
@MapsId("ean")
@JoinColumn(name = "ean")
@JsonIgnoreProperties({"fridges"})
private Product ean;
@Id
......
package ntnu.idatt2016.v233.SmartMat.entity.product;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
......@@ -57,7 +58,7 @@ public class Product{
Double amount;
@ManyToMany
@JsonIgnoreProperties({"products"})
@JsonIgnoreProperties({"products", "users"})
@JoinTable(
name = "product_allergy",
joinColumns = @JoinColumn(name = "ean"),
......@@ -67,10 +68,12 @@ public class Product{
@OneToMany
@JoinColumn(name = "ean")
@JsonIgnoreProperties({"products"})
@JsonIgnore
List<FridgeProductAsso> fridges;
@ManyToMany(mappedBy = "products")
@JsonIgnoreProperties({"products"})
@JsonIgnore
List<Recipe> recipes;
/**
......@@ -84,4 +87,9 @@ public class Product{
fridges.add(fridge);
}
@Override
public String toString(){
return String.valueOf(this.ean);
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment