Advertisement
Guest User

abcabcabc

a guest
Nov 19th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package com.park.parklot.entity;
  7.  
  8. import java.io.Serializable;
  9. import javax.persistence.Entity;
  10. import javax.persistence.GeneratedValue;
  11. import javax.persistence.GenerationType;
  12. import javax.persistence.Id;
  13. import javax.persistence.JoinColumn;
  14. import javax.persistence.ManyToOne;
  15. import javax.persistence.Table;
  16.  
  17. /**
  18. *
  19. * @author Administrator
  20. */
  21. @Entity
  22. @Table(name="CARS")
  23. public class Car implements Serializable {
  24.  
  25. private static final long serialVersionUID = 1L;
  26. @Id
  27. @GeneratedValue(strategy = GenerationType.AUTO)
  28. private Integer id;
  29. private String lincePlate;
  30. private String parkingSpot;
  31.  
  32. public String getLincePlate() {
  33. return lincePlate;
  34. }
  35.  
  36. public void setLincePlate(String lincePlate) {
  37. this.lincePlate = lincePlate;
  38. }
  39.  
  40. public String getParkingSpot() {
  41. return parkingSpot;
  42. }
  43.  
  44. public void setParkingSpot(String parkingSpot) {
  45. this.parkingSpot = parkingSpot;
  46. }
  47.  
  48. public Users getUser() {
  49. return user;
  50. }
  51.  
  52. public void setUser(Users user) {
  53. this.user = user;
  54. }
  55.  
  56.  
  57.  
  58. @ManyToOne
  59. @JoinColumn(name = "USER_ID")
  60. private Users user;
  61.  
  62. public Integer getId() {
  63. return id;
  64. }
  65.  
  66. public void setId(Integer id) {
  67. this.id = id;
  68. }
  69.  
  70. @Override
  71. public int hashCode() {
  72. int hash = 0;
  73. hash += (id != null ? id.hashCode() : 0);
  74. return hash;
  75. }
  76.  
  77. @Override
  78. public boolean equals(Object object) {
  79. // TODO: Warning - this method won't work in the case the id fields are not set
  80. if (!(object instanceof Car)) {
  81. return false;
  82. }
  83. Car other = (Car) object;
  84. if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
  85. return false;
  86. }
  87. return true;
  88. }
  89.  
  90. @Override
  91. public String toString() {
  92. return "com.park.parklot.resources.Car[ id=" + id + " ]";
  93. }
  94.  
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement