You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.3 KiB
68 lines
1.3 KiB
package com.mousetech.gourmetj.persistence.model;
|
|
|
|
import java.io.Serializable;
|
|
import jakarta.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;
|
|
|
|
@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;
|
|
}
|
|
|
|
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();
|
|
}
|
|
} |