diff --git a/src/main/java/guru/springframework/domain/Notes.java b/src/main/java/guru/springframework/domain/Notes.java new file mode 100644 index 0000000000..2fc5dc9ad4 --- /dev/null +++ b/src/main/java/guru/springframework/domain/Notes.java @@ -0,0 +1,49 @@ +package guru.springframework.domain; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Lob; +import javax.persistence.OneToOne; + +@Entity +public class Notes { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @OneToOne + private Recipe recipe; + + @Lob + private String recipeNotes; + + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public Recipe getRecipe() { + return this.recipe; + } + + public void setRecipe(Recipe recipe) { + this.recipe = recipe; + } + + public String getRecipeNotes() { + return this.recipeNotes; + } + + public void setRecipeNotes(String recipeNotes) { + this.recipeNotes = recipeNotes; + } + + +} diff --git a/src/main/java/guru/springframework/domain/Recipe.java b/src/main/java/guru/springframework/domain/Recipe.java new file mode 100644 index 0000000000..8ab380368f --- /dev/null +++ b/src/main/java/guru/springframework/domain/Recipe.java @@ -0,0 +1,115 @@ +package guru.springframework.domain; + +import javax.persistence.CascadeType; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Lob; +import javax.persistence.OneToOne; + +@Entity +public class Recipe { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private String description; + private Integer prepTime; + private Integer cookTime; + private Integer servings; + private String source; + private String url; + private String directions; + //todo add + + @Lob + private Byte[] image; + + @OneToOne(cascade = CascadeType.ALL) + private Notes notes; + + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Integer getPrepTime() { + return this.prepTime; + } + + public void setPrepTime(Integer prepTime) { + this.prepTime = prepTime; + } + + public Integer getCookTime() { + return this.cookTime; + } + + public void setCookTime(Integer cookTime) { + this.cookTime = cookTime; + } + + public Integer getServings() { + return this.servings; + } + + public void setServings(Integer servings) { + this.servings = servings; + } + + public String getSource() { + return this.source; + } + + public void setSource(String source) { + this.source = source; + } + + public String getUrl() { + return this.url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getDirections() { + return this.directions; + } + + public void setDirections(String directions) { + this.directions = directions; + } + + public Byte[] getImage() { + return this.image; + } + + public void setImage(Byte[] image) { + this.image = image; + } + + public Notes getNotes() { + return this.notes; + } + + public void setNotes(Notes notes) { + this.notes = notes; + } + + +}