Advertisement
andresdiaz

Untitled

Jan 22nd, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.25 KB | None | 0 0
  1. package Modelo.beans;
  2.  
  3. import java.io.Serializable;
  4. import javax.persistence.Basic;
  5. import javax.persistence.Column;
  6. import javax.persistence.Entity;
  7. import javax.persistence.GeneratedValue;
  8. import javax.persistence.GenerationType;
  9. import javax.persistence.Id;
  10. import javax.persistence.NamedQueries;
  11. import javax.persistence.NamedQuery;
  12. import javax.persistence.Table;
  13. import javax.validation.constraints.NotNull;
  14. import javax.validation.constraints.Size;
  15. import javax.xml.bind.annotation.XmlRootElement;
  16.  
  17. /**
  18. *
  19. * @author andres
  20. */
  21. @Entity
  22. @Table(name = "equipos")
  23. @XmlRootElement
  24. @NamedQueries({
  25. @NamedQuery(name = "Equipos.findAll", query = "SELECT e FROM Equipos e"),
  26. @NamedQuery(name = "Equipos.findById", query = "SELECT e FROM Equipos e WHERE e.id = :id"),
  27. @NamedQuery(name = "Equipos.findBySerial", query = "SELECT e FROM Equipos e WHERE e.serial = :serial"),
  28. @NamedQuery(name = "Equipos.findByMarca", query = "SELECT e FROM Equipos e WHERE e.marca = :marca"),
  29. @NamedQuery(name = "Equipos.findByTipo", query = "SELECT e FROM Equipos e WHERE e.tipo = :tipo")})
  30. public class Equipos implements Serializable {
  31. private static final long serialVersionUID = 1L;
  32. @Id
  33. @GeneratedValue(strategy = GenerationType.IDENTITY)
  34. @Basic(optional = false)
  35. @Column(name = "id")
  36. private Integer id;
  37. @Basic(optional = false)
  38. @NotNull
  39. @Size(min = 1, max = 100)
  40. @Column(name = "Serial")
  41. private String serial;
  42. @Basic(optional = false)
  43. @NotNull
  44. @Size(min = 1, max = 100)
  45. @Column(name = "marca")
  46. private String marca;
  47. @Basic(optional = false)
  48. @NotNull
  49. @Size(min = 1, max = 100)
  50. @Column(name = "tipo")
  51. private String tipo;
  52.  
  53. public Equipos() {
  54. }
  55.  
  56. public Equipos(Integer id) {
  57. this.id = id;
  58. }
  59.  
  60. public Equipos(Integer id, String serial, String marca, String tipo) {
  61. this.id = id;
  62. this.serial = serial;
  63. this.marca = marca;
  64. this.tipo = tipo;
  65. }
  66.  
  67. public Integer getId() {
  68. return id;
  69. }
  70.  
  71. public void setId(Integer id) {
  72. this.id = id;
  73. }
  74.  
  75. public String getSerial() {
  76. return serial;
  77. }
  78.  
  79. public void setSerial(String serial) {
  80. this.serial = serial;
  81. }
  82.  
  83. public String getMarca() {
  84. return marca;
  85. }
  86.  
  87. public void setMarca(String marca) {
  88. this.marca = marca;
  89. }
  90.  
  91. public String getTipo() {
  92. return tipo;
  93. }
  94.  
  95. public void setTipo(String tipo) {
  96. this.tipo = tipo;
  97. }
  98.  
  99. @Override
  100. public int hashCode() {
  101. int hash = 0;
  102. hash += (id != null ? id.hashCode() : 0);
  103. return hash;
  104. }
  105.  
  106. @Override
  107. public boolean equals(Object object) {
  108. // TODO: Warning - this method won't work in the case the id fields are not set
  109. if (!(object instanceof Equipos)) {
  110. return false;
  111. }
  112. Equipos other = (Equipos) object;
  113. if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
  114. return false;
  115. }
  116. return true;
  117. }
  118.  
  119. @Override
  120. public String toString() {
  121. return "Modelo.beans.Equipos[ id=" + id + " ]";
  122. }
  123.  
  124. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement