Web implementation of the Gourmet Recipe Manager
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.
 
 
 
 

85 lines
1.9 KiB

package com.mousetech.gourmetj.persistence.model;
import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
/**
* The persistent class for the "shopcats" database table.
*
* Properly, a Shopcat should be an optional ManyToOne reference
* from Ingredient, but the database schema does not rigorously
* enforce that. To do so, Ingredient.ingKey would be formally
* declared as a foreign key and in Shopcat.ingKey would be declared
* as a unique key (and could serve as primary key).
*
* Failing that, crud can accumulate in the database and it's
* mostly dealt with in the @see ReceipeDAO.
*
*/
@Entity
@Table(name = "shopcats")
@NamedQueries({
@NamedQuery(name = "Shopcat.findAll", query = "SELECT s FROM Shopcat s"),
@NamedQuery(name = "Shopcat.findIngkey", query = "SELECT s FROM Shopcat s where s.ingkey = :ingkey") })
public class Shopcat implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
@Column(name = "ingkey")
@NotNull
// @UniqueConstraint(name="ingkey")
private String ingkey;
// @OneToMany ingredients
@Column(name = "position")
private Integer position;
@Column(name = "shopcategory")
private String shopcategory;
public Shopcat() {
}
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public String getIngkey() {
return this.ingkey;
}
public void setIngkey(String ingkey) {
this.ingkey = ingkey;
}
public Integer getPosition() {
return this.position;
}
public void setPosition(Integer position) {
this.position = position;
}
public String getShopcategory() {
return this.shopcategory;
}
public void setShopcategory(String shopcategory) {
this.shopcategory = shopcategory;
}
@Override
public String toString() {
return "Shopcat for " + ingkey + "(" + shopcategory
+ ")";
}
}