Created
September 18, 2014 04:05
-
-
Save Pompeu/9c4540abbe4f25fb66be to your computer and use it in GitHub Desktop.
ClassJPAFigura
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package Model; | |
import java.io.Serializable; | |
import javax.persistence.Basic; | |
import javax.persistence.Column; | |
import javax.persistence.Entity; | |
import javax.persistence.GeneratedValue; | |
import javax.persistence.GenerationType; | |
import javax.persistence.Id; | |
import javax.persistence.JoinColumn; | |
import javax.persistence.ManyToOne; | |
import javax.persistence.NamedQueries; | |
import javax.persistence.NamedQuery; | |
import javax.persistence.Table; | |
import javax.xml.bind.annotation.XmlRootElement; | |
/** | |
* | |
* @author pompeu | |
*/ | |
@Entity | |
@Table(name = "figura") | |
@XmlRootElement | |
@NamedQueries({ | |
@NamedQuery(name = "Figura.findAll", query = "SELECT f FROM Figura f"), | |
@NamedQuery(name = "Figura.findByX", query = "SELECT f FROM Figura f WHERE f.x = :x"), | |
@NamedQuery(name = "Figura.findByY", query = "SELECT f FROM Figura f WHERE f.y = :y"), | |
@NamedQuery(name = "Figura.findByLargura", query = "SELECT f FROM Figura f WHERE f.largura = :largura"), | |
@NamedQuery(name = "Figura.findByAltura", query = "SELECT f FROM Figura f WHERE f.altura = :altura"), | |
@NamedQuery(name = "Figura.findByTipo", query = "SELECT f FROM Figura f WHERE f.tipo = :tipo"), | |
@NamedQuery(name = "Figura.findByPkFigura", query = "SELECT f FROM Figura f WHERE f.pkFigura = :pkFigura"), | |
@NamedQuery(name = "Figura.findByColorBorder", query = "SELECT f FROM Figura f WHERE f.colorBorder = :colorBorder"), | |
@NamedQuery(name = "Figura.findByColorInternal", query = "SELECT f FROM Figura f WHERE f.colorInternal = :colorInternal")}) | |
public class Figura implements Serializable { | |
private static final long serialVersionUID = 1L; | |
@Column(name = "x") | |
private Integer x; | |
@Column(name = "y") | |
private Integer y; | |
@Column(name = "largura") | |
private Integer largura; | |
@Column(name = "altura") | |
private Integer altura; | |
@Column(name = "tipo") | |
private Integer tipo; | |
@Id | |
@GeneratedValue(strategy = GenerationType.IDENTITY) | |
@Basic(optional = false) | |
@Column(name = "pk_figura") | |
private Integer pkFigura; | |
@Column(name = "color_border") | |
private Integer colorBorder; | |
@Column(name = "color_internal") | |
private Integer colorInternal; | |
@JoinColumn(name = "fk_save", referencedColumnName = "pk_save") | |
@ManyToOne(optional = false) | |
private FigurasSalvas fkSave; | |
public Figura() { | |
} | |
public Figura(Integer pkFigura) { | |
this.pkFigura = pkFigura; | |
} | |
public Integer getX() { | |
return x; | |
} | |
public void setX(Integer x) { | |
this.x = x; | |
} | |
public Integer getY() { | |
return y; | |
} | |
public void setY(Integer y) { | |
this.y = y; | |
} | |
public Integer getLargura() { | |
return largura; | |
} | |
public void setLargura(Integer largura) { | |
this.largura = largura; | |
} | |
public Integer getAltura() { | |
return altura; | |
} | |
public void setAltura(Integer altura) { | |
this.altura = altura; | |
} | |
public Integer getTipo() { | |
return tipo; | |
} | |
public void setTipo(Integer tipo) { | |
this.tipo = tipo; | |
} | |
public Integer getPkFigura() { | |
return pkFigura; | |
} | |
public void setPkFigura(Integer pkFigura) { | |
this.pkFigura = pkFigura; | |
} | |
public Integer getColorBorder() { | |
return colorBorder; | |
} | |
public void setColorBorder(Integer colorBorder) { | |
this.colorBorder = colorBorder; | |
} | |
public Integer getColorInternal() { | |
return colorInternal; | |
} | |
public void setColorInternal(Integer colorInternal) { | |
this.colorInternal = colorInternal; | |
} | |
public FigurasSalvas getFkSave() { | |
return fkSave; | |
} | |
public void setFkSave(FigurasSalvas fkSave) { | |
this.fkSave = fkSave; | |
} | |
@Override | |
public int hashCode() { | |
int hash = 0; | |
hash += (pkFigura != null ? pkFigura.hashCode() : 0); | |
return hash; | |
} | |
@Override | |
public boolean equals(Object object) { | |
// TODO: Warning - this method won't work in the case the id fields are not set | |
if (!(object instanceof Figura)) { | |
return false; | |
} | |
Figura other = (Figura) object; | |
if ((this.pkFigura == null && other.pkFigura != null) || (this.pkFigura != null && !this.pkFigura.equals(other.pkFigura))) { | |
return false; | |
} | |
return true; | |
} | |
@Override | |
public String toString() { | |
return "Model.Figura[ pkFigura=" + pkFigura + " ]"; | |
} | |
} | |
/** | |
FigurasSalvas | |
*//// | |
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package Model; | |
import java.io.Serializable; | |
import java.util.Collection; | |
import javax.persistence.Basic; | |
import javax.persistence.CascadeType; | |
import javax.persistence.Column; | |
import javax.persistence.Entity; | |
import javax.persistence.GeneratedValue; | |
import javax.persistence.GenerationType; | |
import javax.persistence.Id; | |
import javax.persistence.NamedQueries; | |
import javax.persistence.NamedQuery; | |
import javax.persistence.OneToMany; | |
import javax.persistence.Table; | |
import javax.xml.bind.annotation.XmlRootElement; | |
import javax.xml.bind.annotation.XmlTransient; | |
/** | |
* | |
* @author pompeu | |
*/ | |
@Entity | |
@Table(name = "figuras_salvas") | |
@XmlRootElement | |
@NamedQueries({ | |
@NamedQuery(name = "FigurasSalvas.findAll", query = "SELECT f FROM FigurasSalvas f"), | |
@NamedQuery(name = "FigurasSalvas.findByPkSave", query = "SELECT f FROM FigurasSalvas f WHERE f.pkSave = :pkSave"), | |
@NamedQuery(name = "FigurasSalvas.findBySaveName", query = "SELECT f FROM FigurasSalvas f WHERE f.saveName = :saveName")}) | |
public class FigurasSalvas implements Serializable { | |
private static final long serialVersionUID = 1L; | |
@Id | |
@GeneratedValue(strategy = GenerationType.IDENTITY) | |
@Basic(optional = false) | |
@Column(name = "pk_save") | |
private Integer pkSave; | |
@Column(name = "save_name") | |
private String saveName; | |
@OneToMany(cascade = CascadeType.ALL, mappedBy = "fkSave") | |
private Collection<Figura> figuraCollection; | |
public FigurasSalvas() { | |
} | |
public FigurasSalvas(Integer pkSave) { | |
this.pkSave = pkSave; | |
} | |
public Integer getPkSave() { | |
return pkSave; | |
} | |
public void setPkSave(Integer pkSave) { | |
this.pkSave = pkSave; | |
} | |
public String getSaveName() { | |
return saveName; | |
} | |
public void setSaveName(String saveName) { | |
this.saveName = saveName; | |
} | |
@XmlTransient | |
public Collection<Figura> getFiguraCollection() { | |
return figuraCollection; | |
} | |
public void setFiguraCollection(Collection<Figura> figuraCollection) { | |
this.figuraCollection = figuraCollection; | |
} | |
@Override | |
public int hashCode() { | |
int hash = 0; | |
hash += (pkSave != null ? pkSave.hashCode() : 0); | |
return hash; | |
} | |
@Override | |
public boolean equals(Object object) { | |
// TODO: Warning - this method won't work in the case the id fields are not set | |
if (!(object instanceof FigurasSalvas)) { | |
return false; | |
} | |
FigurasSalvas other = (FigurasSalvas) object; | |
if ((this.pkSave == null && other.pkSave != null) || (this.pkSave != null && !this.pkSave.equals(other.pkSave))) { | |
return false; | |
} | |
return true; | |
} | |
@Override | |
public String toString() { | |
return "Model.FigurasSalvas[ pkSave=" + pkSave + " ]"; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment