BlogEntity.java 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package com.itant.laf.model;
  2. import javax.persistence.*;
  3. /**
  4. * Created by sjj on 2015/10/24 0024.
  5. */
  6. @Entity
  7. @Table(name = "blog", schema = "laf", catalog = "")
  8. public class BlogEntity {
  9. private int id;
  10. private String title;
  11. private String content;
  12. private UserEntity userByUserid;
  13. @Id
  14. @Column(name = "id", nullable = false, insertable = true, updatable = true)
  15. public int getId() {
  16. return id;
  17. }
  18. public void setId(int id) {
  19. this.id = id;
  20. }
  21. @Basic
  22. @Column(name = "title", nullable = true, insertable = true, updatable = true, length = 100)
  23. public String getTitle() {
  24. return title;
  25. }
  26. public void setTitle(String title) {
  27. this.title = title;
  28. }
  29. @Basic
  30. @Column(name = "content", nullable = true, insertable = true, updatable = true, length = 255)
  31. public String getContent() {
  32. return content;
  33. }
  34. public void setContent(String content) {
  35. this.content = content;
  36. }
  37. @Override
  38. public boolean equals(Object o) {
  39. if (this == o) return true;
  40. if (o == null || getClass() != o.getClass()) return false;
  41. BlogEntity that = (BlogEntity) o;
  42. if (id != that.id) return false;
  43. if (title != null ? !title.equals(that.title) : that.title != null) return false;
  44. if (content != null ? !content.equals(that.content) : that.content != null) return false;
  45. return true;
  46. }
  47. @Override
  48. public int hashCode() {
  49. int result = id;
  50. result = 31 * result + (title != null ? title.hashCode() : 0);
  51. result = 31 * result + (content != null ? content.hashCode() : 0);
  52. return result;
  53. }
  54. @ManyToOne
  55. @JoinColumn(name = "userid", referencedColumnName = "id")
  56. public UserEntity getUserByUserid() {
  57. return userByUserid;
  58. }
  59. public void setUserByUserid(UserEntity userByUserid) {
  60. this.userByUserid = userByUserid;
  61. }
  62. }