Guest User

Untitled

a guest
Jan 22nd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.83 KB | None | 0 0
  1. import javax.persistence.*;
  2. import java.util.ArrayList;
  3. import java.util.List;
  4. import java.util.Objects;
  5.  
  6.  
  7. @Entity(name = "Subsidiary")
  8. @Table(name = "SUCURSAL")
  9. public class Subsidiary {
  10.  
  11. @Id
  12. @SequenceGenerator(name = "SEQ_SUBSIDIARY", sequenceName = "SUCURSAL_SEQ", allocationSize = 1)
  13. @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_SUBSIDIARY")
  14. @Column(name = "NUMCODIGOSUCURSAL")
  15. private int subsidiaryId;
  16.  
  17. @Column(name = "VCHDESCRIPCION")
  18. private String description;
  19. @Column(name = "NUMTELEFONO")
  20. private String phone;
  21. @Column(name = "NUMSERIE")
  22. private Integer serie;
  23.  
  24. @Column(name = "CHRESTADO")
  25. private Character state;
  26. @Column(name = "VCHDIRECCION")
  27. private String address;
  28. @Column(name = "CHRCODIGOUBIGEO")
  29. private String ubigeo;
  30. @Column(name = "NUMCODIGONIVEL")
  31. private Integer levelCode;
  32. @Column(name = "VCHTELEFONO")
  33. private String phone2;
  34.  
  35.  
  36. @OneToMany(
  37. mappedBy = "subsidiary",
  38. cascade = CascadeType.ALL,
  39. orphanRemoval = true
  40. )
  41. private List<SubsidiaryUser> users = new ArrayList<>();
  42.  
  43. public String getDescription() {
  44. return description;
  45. }
  46.  
  47. public void setDescription(String description) {
  48. this.description = description;
  49. }
  50.  
  51. public String getPhone() {
  52. return phone;
  53. }
  54.  
  55. public void setPhone(String phone) {
  56. this.phone = phone;
  57. }
  58.  
  59. public Integer getSerie() {
  60. return serie;
  61. }
  62.  
  63. public void setSerie(Integer serie) {
  64. this.serie = serie;
  65. }
  66.  
  67. public int getSubsidiaryId() {
  68. return subsidiaryId;
  69. }
  70.  
  71. public void setSubsidiaryId(int subsidiaryId) {
  72. this.subsidiaryId = subsidiaryId;
  73. }
  74.  
  75. public Character getState() {
  76. return state;
  77. }
  78.  
  79. public void setState(Character state) {
  80. this.state = state;
  81. }
  82.  
  83. public String getAddress() {
  84. return address;
  85. }
  86.  
  87. public void setAddress(String address) {
  88. this.address = address;
  89. }
  90.  
  91. public String getUbigeo() {
  92. return ubigeo;
  93. }
  94.  
  95. public void setUbigeo(String ubigeo) {
  96. this.ubigeo = ubigeo;
  97. }
  98.  
  99. public Integer getLevelCode() {
  100. return levelCode;
  101. }
  102.  
  103. public void setLevelCode(Integer levelCode) {
  104. this.levelCode = levelCode;
  105. }
  106.  
  107. public String getPhone2() {
  108. return phone2;
  109. }
  110.  
  111. public void setPhone2(String phone2) {
  112. this.phone2 = phone2;
  113. }
  114.  
  115. public List<SubsidiaryUser> getUsers() {
  116. return users;
  117. }
  118.  
  119. public void setUsers(List<SubsidiaryUser> users) {
  120. this.users = users;
  121. }
  122.  
  123. public Subsidiary() {
  124. }
  125.  
  126. public Subsidiary(String description, String phone, Integer serie, Character state, String address, String ubigeo, Integer levelCode, String phone2) {
  127. this.description = description;
  128. this.phone = phone;
  129. this.serie = serie;
  130. this.state = state;
  131. this.address = address;
  132. this.ubigeo = ubigeo;
  133. this.levelCode = levelCode;
  134. this.phone2 = phone2;
  135. }
  136.  
  137. @Override
  138. public boolean equals(Object o) {
  139. if (this == o) return true;
  140. if (o == null || getClass() != o.getClass()) return false;
  141. Subsidiary that = (Subsidiary) o;
  142. return Objects.equals(description, that.description) &&
  143. Objects.equals(phone, that.phone) &&
  144. Objects.equals(serie, that.serie) &&
  145. Objects.equals(state, that.state) &&
  146. Objects.equals(address, that.address) &&
  147. Objects.equals(ubigeo, that.ubigeo) &&
  148. Objects.equals(levelCode, that.levelCode) &&
  149. Objects.equals(phone2, that.phone2);
  150. }
  151.  
  152. @Override
  153. public int hashCode() {
  154.  
  155. return Objects.hash(description, phone, serie, state, address, ubigeo, levelCode, phone2);
  156. }
Add Comment
Please, Sign In to add comment