Guest User

Untitled

a guest
Dec 19th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.61 KB | None | 0 0
  1. CREATE TABLE public.covek
  2. (
  3. maticen_broj varchar(13) NOT NULL,
  4. ime_i_prezime varchar(50) NULL,
  5. datum_na_ragjanje date nUll,
  6. username varchar(20) NOT NULL,
  7. password varchar(20) NOT NULL,
  8. tip_pacient bool NOT NULL,
  9. tip_lekar bool NOT NULL,
  10. pol varchar(1) NULL,
  11. PRIMARY KEY (maticen_broj),
  12. UNIQUE (username, maticen_broj)
  13. )
  14.  
  15. CREATE TABLE public.lekar
  16. (
  17. reden_broj_lekar bigserial NOT null,
  18. maticen_broj varchar(13) references covek(maticen_broj),
  19. tip varchar(1) NULL,
  20. PRIMARY KEY (reden_broj_lekar)
  21. )
  22.  
  23. import java.util.Date;
  24. import javax.persistence.Column;
  25. import javax.persistence.Entity;
  26. import javax.persistence.Id;
  27. import javax.persistence.Table;
  28. import javax.persistence.Temporal;
  29. import javax.persistence.TemporalType;
  30. import javax.persistence.UniqueConstraint;
  31. /**
  32. * Covek generated by hbm2java
  33. */
  34. @Entity
  35. @Table(name = "covek", schema = "public", uniqueConstraints = @UniqueConstraint(columnNames = { "username", "maticen_broj" }))
  36. public class Covek implements java.io.Serializable {
  37.  
  38. private String maticenBroj;
  39. private String imeIPrezime;
  40. private Date datumNaRagjanje;
  41. private String username;
  42. private String password;
  43. private boolean tipPacient;
  44. private boolean tipLekar;
  45. private String pol;
  46.  
  47. public Covek() {
  48. }
  49.  
  50. public Covek(String maticenBroj, String username, String password, boolean tipPacient, boolean tipLekar) {
  51. this.maticenBroj = maticenBroj;
  52. this.username = username;
  53. this.password = password;
  54. this.tipPacient = tipPacient;
  55. this.tipLekar = tipLekar;
  56. }
  57.  
  58. public Covek(String maticenBroj, String imeIPrezime, Date datumNaRagjanje, String username, String password,
  59. boolean tipPacient, boolean tipLekar, String pol) {
  60. this.maticenBroj = maticenBroj;
  61. this.imeIPrezime = imeIPrezime;
  62. this.datumNaRagjanje = datumNaRagjanje;
  63. this.username = username;
  64. this.password = password;
  65. this.tipPacient = tipPacient;
  66. this.tipLekar = tipLekar;
  67. this.pol = pol;
  68. }
  69.  
  70. @Id
  71.  
  72. @Column(name = "maticen_broj", unique = true, nullable = false, length = 13)
  73. public String getMaticenBroj() {
  74. return this.maticenBroj;
  75. }
  76.  
  77. public void setMaticenBroj(String maticenBroj) {
  78. this.maticenBroj = maticenBroj;
  79. }
  80.  
  81. @Column(name = "ime_i_prezime", length = 50)
  82. public String getImeIPrezime() {
  83. return this.imeIPrezime;
  84. }
  85.  
  86. public void setImeIPrezime(String imeIPrezime) {
  87. this.imeIPrezime = imeIPrezime;
  88. }
  89.  
  90. @Temporal(TemporalType.DATE)
  91. @Column(name = "datum_na_ragjanje", length = 13)
  92. public Date getDatumNaRagjanje() {
  93. return this.datumNaRagjanje;
  94. }
  95.  
  96. public void setDatumNaRagjanje(Date datumNaRagjanje) {
  97. this.datumNaRagjanje = datumNaRagjanje;
  98. }
  99.  
  100. @Column(name = "username", nullable = false, length = 20)
  101. public String getUsername() {
  102. return this.username;
  103. }
  104.  
  105. public void setUsername(String username) {
  106. this.username = username;
  107. }
  108.  
  109. @Column(name = "password", nullable = false, length = 20)
  110. public String getPassword() {
  111. return this.password;
  112. }
  113.  
  114. public void setPassword(String password) {
  115. this.password = password;
  116. }
  117.  
  118. @Column(name = "tip_pacient", nullable = false)
  119. public boolean isTipPacient() {
  120. return this.tipPacient;
  121. }
  122.  
  123. public void setTipPacient(boolean tipPacient) {
  124. this.tipPacient = tipPacient;
  125. }
  126.  
  127. @Column(name = "tip_lekar", nullable = false)
  128. public boolean isTipLekar() {
  129. return this.tipLekar;
  130. }
  131.  
  132. public void setTipLekar(boolean tipLekar) {
  133. this.tipLekar = tipLekar;
  134. }
  135.  
  136. @Column(name = "pol", length = 1)
  137. public String getPol() {
  138. return this.pol;
  139. }
  140.  
  141. public void setPol(String pol) {
  142. this.pol = pol;
  143. }
  144. }
  145.  
  146. import javax.persistence.Column;
  147. import javax.persistence.Entity;
  148. import javax.persistence.Id;
  149. import javax.persistence.Table;
  150. /**
  151. * Lekar generated by hbm2java
  152. */
  153. @Entity
  154. @Table(name = "lekar", schema = "public")
  155. public class Lekar implements java.io.Serializable {
  156.  
  157. private long redenBrojLekar;
  158. private String maticenBroj;
  159. private String tip;
  160.  
  161. public Lekar() {
  162. }
  163.  
  164. public Lekar(long redenBrojLekar) {
  165. this.redenBrojLekar = redenBrojLekar;
  166. }
  167.  
  168. public Lekar(long redenBrojLekar, String maticenBroj, String tip) {
  169. this.redenBrojLekar = redenBrojLekar;
  170. this.maticenBroj = maticenBroj;
  171. this.tip = tip;
  172. }
  173.  
  174. @Id
  175.  
  176. @Column(name = "reden_broj_lekar", unique = true, nullable = false)
  177. public long getRedenBrojLekar() {
  178. return this.redenBrojLekar;
  179. }
  180.  
  181. public void setRedenBrojLekar(long redenBrojLekar) {
  182. this.redenBrojLekar = redenBrojLekar;
  183. }
  184.  
  185. @Column(name = "maticen_broj", length = 13)
  186. public String getMaticenBroj() {
  187. return this.maticenBroj;
  188. }
  189.  
  190. public void setMaticenBroj(String maticenBroj) {
  191. this.maticenBroj = maticenBroj;
  192. }
  193.  
  194. @Column(name = "tip", length = 1)
  195. public String getTip() {
  196. return this.tip;
  197. }
  198.  
  199. public void setTip(String tip) {
  200. this.tip = tip;
  201. }
  202. }
Add Comment
Please, Sign In to add comment