Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.21 KB | None | 0 0
  1. package mk.klikniobrok.models;
  2.  
  3. import javax.persistence.*;
  4. import java.io.Serializable;
  5. import java.sql.Date;
  6. import java.sql.Timestamp;
  7.  
  8. /**
  9. * Created by andrejnaumovski on 12/8/16.
  10. */
  11.  
  12. @Entity
  13. @Table(name = "user")
  14. @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
  15. @DiscriminatorColumn(name = "TYPE", discriminatorType=DiscriminatorType.STRING)
  16. @DiscriminatorValue("USER")
  17. public class User {
  18. @Id
  19. private String username;
  20. private String password;
  21. private int enabled;
  22. @Column(name = "date_created", insertable = false, updatable = false)
  23. @Basic(optional = false)
  24. @Temporal(TemporalType.TIMESTAMP)
  25. private java.util.Date dateCreated;
  26. @Column(name = "last_used")
  27. @Temporal(TemporalType.TIMESTAMP)
  28. private java.util.Date lastUsed;
  29. @Enumerated
  30. private Role role;
  31.  
  32. public User() {
  33.  
  34. }
  35.  
  36. public User(
  37. String username,
  38. String password,
  39. int enabled,
  40. java.util.Date dateCreated,
  41. java.util.Date lastUsed,
  42. Role role
  43. ) {
  44. this.username = username;
  45. this.password = password;
  46. this.enabled = enabled;
  47. this.dateCreated = dateCreated;
  48. this.lastUsed = lastUsed;
  49. this.role = role;
  50. }
  51.  
  52. public String getUsername() {
  53. return username;
  54. }
  55.  
  56. public void setUsername(String username) {
  57. this.username = username;
  58. }
  59.  
  60. public String getPassword() {
  61. return password;
  62. }
  63.  
  64. public void setPassword(String password) {
  65. this.password = password;
  66. }
  67.  
  68. public int isEnabled() {
  69. return enabled;
  70. }
  71.  
  72. public void setEnabled(int enabled) {
  73. this.enabled = enabled;
  74. }
  75.  
  76. @Column(name = "date_created")
  77. public java.util.Date getDateCreated() {
  78. return dateCreated;
  79. }
  80.  
  81. public void setDateCreated(Timestamp dateCreated) {
  82. this.dateCreated = dateCreated;
  83. }
  84.  
  85. @Column(name = "last_used")
  86. public java.util.Date getLastUsed() {
  87. return lastUsed;
  88. }
  89.  
  90. public void setLastUsed(Timestamp lastUsed) {
  91. this.lastUsed = lastUsed;
  92. }
  93.  
  94. public Role getRole() {
  95. return role;
  96. }
  97.  
  98. public void setRole(Role role) {
  99. this.role = role;
  100. }
  101. }
  102.  
  103. package mk.klikniobrok.models;
  104.  
  105. import javax.persistence.*;
  106.  
  107. /**
  108. * Created by andrejnaumovski on 12/8/16.
  109. */
  110.  
  111. @Entity
  112. @Table(name = "customer")
  113. @DiscriminatorValue("CUSTOMER")
  114. public class Customer extends User {
  115. @Column(name = "email")
  116. private String email;
  117. @Column(name = "first_name")
  118. private String firstName;
  119. @Column(name = "last_name")
  120. private String lastName;
  121. @Column(name = "image_url")
  122. private String imageUrl;
  123.  
  124. public Customer() {
  125. super();
  126. }
  127.  
  128. public Customer(String username,
  129. String password,
  130. int enabled,
  131. java.util.Date dateCreated,
  132. java.util.Date lastUsed,
  133. Role role,
  134. String email,
  135. String firstName,
  136. String lastName,
  137. String imageUrl
  138. ) {
  139. super(username, password, enabled, dateCreated, lastUsed, role);
  140. this.email = email;
  141. this.firstName = firstName;
  142. this.lastName = lastName;
  143. this.imageUrl = imageUrl;
  144. }
  145.  
  146. public String getEmail() {
  147. return email;
  148. }
  149.  
  150. public void setEmail(String email) {
  151. this.email = email;
  152. }
  153.  
  154. public String getFirstName() {
  155. return firstName;
  156. }
  157.  
  158. public void setFirstName(String firstName) {
  159. this.firstName = firstName;
  160. }
  161.  
  162. public String getLastName() {
  163. return lastName;
  164. }
  165.  
  166. public void setLastName(String lastName) {
  167. this.lastName = lastName;
  168. }
  169.  
  170. public String getImageUrl() {
  171. return imageUrl;
  172. }
  173.  
  174. public void setImageUrl(String imageUrl) {
  175. this.imageUrl = imageUrl;
  176. }
  177. }
  178.  
  179. {
  180. "timestamp": 1481218619875,
  181. "status": 500,
  182. "error": "Internal Server Error",
  183. "exception": "org.springframework.dao.InvalidDataAccessResourceUsageException",
  184. "message": "could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet",
  185. "path": "/customer/"
  186. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement