Guest User

Untitled

a guest
Jan 31st, 2018
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.79 KB | None | 0 0
  1. @Entity
  2. @Table(name = "services")
  3. public class Service {
  4. @Id
  5. @GeneratedValue(strategy = GenerationType.AUTO)
  6. private Long id;
  7.  
  8. @Column(name = "userid")
  9. private Long userId;
  10.  
  11. @Column(name = "service_name")
  12. private String nameOfService;
  13.  
  14. @Column(name = "cost")
  15. private Integer serviceCost;
  16.  
  17. @Column(name = "category")
  18. private String category;
  19.  
  20. @Column(name = "description")
  21. private String description;
  22.  
  23. @Column(name = "country")
  24. private String country;
  25.  
  26. @Column(name = "city")
  27. private String city;
  28.  
  29. @Column(name = "type_of_service")
  30. private String typeOfService;
  31.  
  32. @Column(name = "currency")
  33. private String currency;
  34.  
  35. @ManyToOne(fetch = FetchType.LAZY)
  36. @JoinColumn(name = "user_id")
  37. private User user;
  38.  
  39. public Long getId() {
  40. return id;
  41. }
  42.  
  43. public void setId(Long id) {
  44. this.id = id;
  45. }
  46.  
  47. public Long getUserId() {
  48. return userId;
  49. }
  50.  
  51. public void setUserId(Long userId) {
  52. this.userId = userId;
  53. }
  54.  
  55. public String getNameOfService() {
  56. return nameOfService;
  57. }
  58.  
  59. public void setNameOfService(String nameOfService) {
  60. this.nameOfService = nameOfService;
  61. }
  62.  
  63. public Integer getServiceCost() {
  64. return serviceCost;
  65. }
  66.  
  67. public void setServiceCost(Integer serviceCost) {
  68. this.serviceCost = serviceCost;
  69. }
  70.  
  71. public String getCategory() {
  72. return category;
  73. }
  74.  
  75. public void setCategory(String category) {
  76. this.category = category;
  77. }
  78.  
  79. public String getDescription() {
  80. return description;
  81. }
  82.  
  83. public void setDescription(String description) {
  84. this.description = description;
  85. }
  86.  
  87. public String getCountry() {
  88. return country;
  89. }
  90.  
  91. public void setCountry(String country) {
  92. this.country = country;
  93. }
  94.  
  95. public String getCity() {
  96. return city;
  97. }
  98.  
  99. public void setCity(String city) {
  100. this.city = city;
  101. }
  102.  
  103. public String getTypeOfService() {
  104. return typeOfService;
  105. }
  106.  
  107. public void setTypeOfService(String typeOfService) {
  108. this.typeOfService = typeOfService;
  109. }
  110.  
  111. public String getCurrency() {
  112. return currency;
  113. }
  114.  
  115. public void setCurrency(String currency) {
  116. this.currency = currency;
  117. }
  118.  
  119. public User getUser() {
  120. return user;
  121. }
  122.  
  123. public void setUser(User user) {
  124. this.user = user;
  125. }
  126. }
  127.  
  128. @Entity
  129. @Table(name = "users")
  130. public class User {
  131. @Id
  132. @GeneratedValue(strategy = GenerationType.AUTO)
  133. private Long id;
  134.  
  135. @Column(name = "username")
  136. private String username;
  137.  
  138. @Column(name = "password")
  139. private String password;
  140.  
  141. @Column(name = "is_registration_confirmed")
  142. private Boolean isRegistrationConfirmed;
  143.  
  144. @Column(name = "key_for_registration_confirm")
  145. private String keyForRegistrationConfirmUrl;
  146.  
  147. @Column(name = "login")
  148. private String login;
  149.  
  150. @Column(name = "date_of_registration")
  151. private Date dateOfRegistration;
  152.  
  153. @Transient
  154. private String confirmPassword;
  155.  
  156. @Column(name = "first_name")
  157. private String firstName;
  158.  
  159. @Column(name = "gender")
  160. private String gender;
  161.  
  162. @Column(name = "date_of_birth")
  163. private String dateOfBirth;
  164.  
  165. @Column(name = "country")
  166. private String country;
  167.  
  168. @Column(name = "path_to_avatar")
  169. private String avatar;
  170.  
  171. @ManyToMany
  172. @JoinTable(name = "user_roles", joinColumns = @JoinColumn(name = "user_id"),
  173. inverseJoinColumns = @JoinColumn(name = "role_id"))
  174. private Set<Role> roles;
  175.  
  176. @OneToMany(mappedBy = "user", /*cascade = CascadeType.ALL, */fetch = FetchType.LAZY/*, orphanRemoval = true*/)
  177. private Set<Service> services;
  178.  
  179. public Long getId() {
  180. return id;
  181. }
  182.  
  183. public void setId(Long id) {
  184. this.id = id;
  185. }
  186.  
  187. public String getUsername() {
  188. return username;
  189. }
  190.  
  191. public void setUsername(String username) {
  192. this.username = username;
  193. }
  194.  
  195. public String getPassword() {
  196. return password;
  197. }
  198.  
  199. public void setPassword(String password) {
  200. this.password = password;
  201. }
  202.  
  203. public Boolean getRegistrationConfirmed() {
  204. return isRegistrationConfirmed;
  205. }
  206.  
  207. public void setRegistrationConfirmed(Boolean registrationConfirmed) {
  208. isRegistrationConfirmed = registrationConfirmed;
  209. }
  210.  
  211. public String getKeyForRegistrationConfirmUrl() {
  212. return keyForRegistrationConfirmUrl;
  213. }
  214.  
  215. public void setKeyForRegistrationConfirmUrl(String keyForRegistrationConfirmUrl) {
  216. this.keyForRegistrationConfirmUrl = keyForRegistrationConfirmUrl;
  217. }
  218.  
  219. public String getLogin() {
  220. return login;
  221. }
  222.  
  223. public void setLogin(String login) {
  224. this.login = login;
  225. }
  226.  
  227. public Date getDateOfRegistration() {
  228. return dateOfRegistration;
  229. }
  230.  
  231. public void setDateOfRegistration(Date dateOfRegistration) {
  232. this.dateOfRegistration = dateOfRegistration;
  233. }
  234.  
  235. public String getConfirmPassword() {
  236. return confirmPassword;
  237. }
  238.  
  239. public void setConfirmPassword(String confirmPassword) {
  240. this.confirmPassword = confirmPassword;
  241. }
  242.  
  243. public String getFirstName() {
  244. return firstName;
  245. }
  246.  
  247. public void setFirstName(String firstName) {
  248. this.firstName = firstName;
  249. }
  250.  
  251. public String getGender() {
  252. return gender;
  253. }
  254.  
  255. public void setGender(String gender) {
  256. this.gender = gender;
  257. }
  258.  
  259. public String getDateOfBirth() {
  260. return dateOfBirth;
  261. }
  262.  
  263. public void setDateOfBirth(String dateOfBirth) {
  264. this.dateOfBirth = dateOfBirth;
  265. }
  266.  
  267. public String getCountry() {
  268. return country;
  269. }
  270.  
  271. public void setCountry(String country) {
  272. this.country = country;
  273. }
  274.  
  275. public String getAvatar() {
  276. return avatar;
  277. }
  278.  
  279. public void setAvatar(String avatar) {
  280. this.avatar = avatar;
  281. }
  282.  
  283. public Set<Role> getRoles() {
  284. return roles;
  285. }
  286.  
  287. public void setRoles(Set<Role> roles) {
  288. this.roles = roles;
  289. }
  290.  
  291. public Set<Service> getServices() {
  292. return services;
  293. }
  294.  
  295. public void setServices(Set<Service> services) {
  296. this.services = services;
  297. }
  298. }
  299.  
  300. 16:22:30.763 [http-nio-8087-exec-7] ERROR o.h.e.j.s.SqlExceptionHelper#146 Unknown column 'service0_.user_id' in 'field list'
Add Comment
Please, Sign In to add comment