Advertisement
Guest User

Untitled

a guest
Sep 8th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.64 KB | None | 0 0
  1. package models;
  2.  
  3. @Id
  4. @Column(name = "codEmpleado")
  5. public byte getCodEmpleado() {
  6. return codEmpleado;
  7. }
  8.  
  9. public void setCodEmpleado(byte codEmpleado) {
  10. this.codEmpleado = codEmpleado;
  11. }
  12.  
  13. @Basic
  14. @Column(name = "nombres")
  15. public String getNombres() {
  16. return nombres;
  17. }
  18.  
  19. public void setNombres(String nombres) {
  20. this.nombres = nombres;
  21. }
  22.  
  23. @Basic
  24. @Column(name = "apellido")
  25. public String getApellido() {
  26. return apellido;
  27. }
  28.  
  29. public void setApellido(String apellido) {
  30. this.apellido = apellido;
  31. }
  32.  
  33. @Basic
  34. @Column(name = "sexo")
  35. public String getSexo() {
  36. return sexo;
  37. }
  38.  
  39. public void setSexo(String sexo) {
  40. this.sexo = sexo;
  41. }
  42.  
  43. @Override
  44. public boolean equals(Object o) {
  45. if (this == o) return true;
  46. if (o == null || getClass() != o.getClass()) return false;
  47.  
  48. EmpleadoEntity that = (EmpleadoEntity) o;
  49.  
  50. if (codEmpleado != that.codEmpleado) return false;
  51. if (nombres != null ? !nombres.equals(that.nombres) : that.nombres != null) return false;
  52. if (apellido != null ? !apellido.equals(that.apellido) : that.apellido != null) return false;
  53. if (sexo != null ? !sexo.equals(that.sexo) : that.sexo != null) return false;
  54.  
  55. return true;
  56. }
  57.  
  58. @Override
  59. public int hashCode() {
  60. int result = (int) codEmpleado;
  61. result = 31 * result + (nombres != null ? nombres.hashCode() : 0);
  62. result = 31 * result + (apellido != null ? apellido.hashCode() : 0);
  63. result = 31 * result + (sexo != null ? sexo.hashCode() : 0);
  64. return result;
  65. }
  66.  
  67. @Id
  68. @Column(name = "codUsuario")
  69. public byte getCodUsuario() {
  70. return codUsuario;
  71. }
  72.  
  73. public void setCodUsuario(byte codUsuario) {
  74. this.codUsuario = codUsuario;
  75. }
  76.  
  77. @Basic
  78. @Column(name = "nombre")
  79. public String getNombre() {
  80. return nombre;
  81. }
  82.  
  83. public void setNombre(String nombre) {
  84. this.nombre = nombre;
  85. }
  86.  
  87. @Basic
  88. @Column(name = "clave")
  89. public String getClave() {
  90. return clave;
  91. }
  92.  
  93. public void setClave(String clave) {
  94. this.clave = clave;
  95. }
  96.  
  97. @Override
  98. public boolean equals(Object o) {
  99. if (this == o) return true;
  100. if (o == null || getClass() != o.getClass()) return false;
  101.  
  102. UsuarioEntity that = (UsuarioEntity) o;
  103.  
  104. if (codUsuario != that.codUsuario) return false;
  105. if (nombre != null ? !nombre.equals(that.nombre) : that.nombre != null) return false;
  106. if (clave != null ? !clave.equals(that.clave) : that.clave != null) return false;
  107.  
  108. return true;
  109. }
  110.  
  111. @Override
  112. public int hashCode() {
  113. int result = (int) codUsuario;
  114. result = 31 * result + (nombre != null ? nombre.hashCode() : 0);
  115. result = 31 * result + (clave != null ? clave.hashCode() : 0);
  116. return result;
  117. }
  118.  
  119. @OneToOne(mappedBy = "usuarioByCodEmpleado")
  120. public EmpleadoEntity getEmpleadoByCodUsuario() {
  121. return empleadoByCodUsuario;
  122. }
  123.  
  124. public void setEmpleadoByCodUsuario(EmpleadoEntity empleadoByCodUsuario) {
  125. this.empleadoByCodUsuario = empleadoByCodUsuario;
  126. }
  127.  
  128. <persistence-unit name="NewPersistenceUnit">
  129. <provider>org.hibernate.ejb.HibernatePersistence</provider>
  130. <class>models.EmpleadoEntity</class>
  131. <class>models.UsuarioEntity</class>
  132. <properties>
  133. <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/Persistencia"/>
  134. <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
  135. <property name="hibernate.connection.username" value="root"/>
  136. <property name="hibernate.connection.password" value="Mariana2803"/>
  137. <property name="hibernate.archive.autodetection" value="class"/>
  138. <property name="hibernate.show_sql" value="true"/>
  139. <property name="hibernate.format_sql" value="true"/>
  140. <property name="hbm2ddl.auto" value="update"/>
  141. </properties>
  142. </persistence-unit>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement