Zizalik

CurrencyDATABASE1

May 16th, 2018
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. package DB;
  2.  
  3. import java.io.Serializable;
  4. import javax.persistence.Column;
  5. import javax.persistence.Entity;
  6. import javax.persistence.GeneratedValue;
  7. import javax.persistence.GenerationType;
  8. import javax.persistence.Id;
  9. import javax.persistence.JoinColumn;
  10. import javax.persistence.ManyToOne;
  11. import javax.persistence.Table;
  12.  
  13. @Entity
  14. @Table(name = "Currency")
  15. public class Currency implements Serializable {
  16.  
  17. @Id
  18. @GeneratedValue(strategy = GenerationType.IDENTITY)
  19. @Column(name = "id")
  20. Long id;
  21.  
  22. @Column(name = "ShortName", nullable = false, length = 10)
  23. private String shortname;
  24.  
  25. @Column(name = "FullName", nullable = false, length = 50)
  26. private String fullname;
  27.  
  28. @Column(name = "Unit", nullable = false, length = 50)
  29. private String unit;
  30.  
  31. @Column(name = "Symbol", nullable = true, length = 10)
  32. private String symbol;
  33.  
  34. @ManyToOne
  35. @JoinColumn(name = "country_id")
  36. private int country;
  37.  
  38.  
  39. public Currency() {
  40. }
  41.  
  42. public Currency(String shortname, String fullname, int country) {
  43. this.shortname = shortname;
  44. this.fullname = fullname;
  45. this.country = country;
  46. }
  47.  
  48. public Currency(String shortname, String fullname, int country, String unit) {
  49. this.shortname = shortname;
  50. this.fullname = fullname;
  51. this.country = country;
  52. this.unit = unit;
  53. }
  54.  
  55.  
  56. public Long getId() {
  57. return id;
  58. }
  59.  
  60. public void setId(Long id) {
  61. this.id = id;
  62. }
  63.  
  64. public String getShortName() {
  65. return shortname;
  66. }
  67.  
  68. public void setShortName(String shortname) {
  69. this.shortname = shortname;
  70. }
  71.  
  72. public String getFullName() {
  73. return fullname;
  74. }
  75.  
  76. public void setFullName(String fullname) {
  77. this.fullname = fullname;
  78. }
  79.  
  80. public String getUnit() {
  81. return unit;
  82. }
  83.  
  84. public void setUnit(String unit) {
  85. this.unit = unit;
  86. }
  87.  
  88. public String getSymbol() {
  89. return symbol;
  90. }
  91.  
  92. public void setSymbol(String symbol) {
  93. this.symbol = symbol;
  94. }
  95.  
  96. public int getCountry() {
  97. return country;
  98. }
  99.  
  100. public void setCountry(int country) {
  101. this.country = country;
  102. }
  103.  
  104. @Override
  105. public String toString() {
  106. return "\n\nCurrency: \n id=" + id + "\n sShortname: " + shortname + "\n Fullname: " + fullname
  107. + "\n Unit: " + unit + "\n Symbol: " + symbol+ "\n Country: " + country +" ";
  108. }
  109. }
Add Comment
Please, Sign In to add comment