gourmetj-springboot/src/main/java/com/mousetech/gourmetj/persistence/model/Category.java

68 lines
1.3 KiB
Java
Raw Normal View History

2021-12-28 17:24:58 +00:00
package com.mousetech.gourmetj.persistence.model;
import java.io.Serializable;
import javax.persistence.*;
/**
* The persistent class for the "categories" database table.
* Generally only one category gets assigned per recipe, but the
* schema allows for more. There is no master category name
* table.
*/
@Entity
@Table(name="categories")
@NamedQuery(name="Category.findAll", query="SELECT c FROM Category c")
public class Category implements Serializable {
private static final long serialVersionUID = 1L;
@Column(name="category")
private String category;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="id")
private Long id;
2021-12-28 18:30:53 +00:00
@ManyToOne(fetch=FetchType.EAGER, optional = false)
@JoinColumn(name="recipe_id")
private Recipe recipe;
/**
* @return the parent recipe
*/
public Recipe getRecipe() {
return recipe;
}
/**
* @param recipe the parent recipe to set
*/
public void setRecipe(Recipe recipe) {
this.recipe = recipe;
}
2021-12-28 17:24:58 +00:00
public Category() {
}
public String getCategory() {
return this.category;
}
public void setCategory(String category) {
this.category = category;
}
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
@Override
public String toString() {
return this.getCategory();
}
}