Message.java 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright 2020 the original author or authors.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * https://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package example;
  17. import java.util.Calendar;
  18. import jakarta.persistence.Entity;
  19. import jakarta.persistence.GeneratedValue;
  20. import jakarta.persistence.GenerationType;
  21. import jakarta.persistence.Id;
  22. import jakarta.persistence.ManyToOne;
  23. @Entity
  24. public class Message {
  25. @Id
  26. @GeneratedValue(strategy = GenerationType.AUTO)
  27. private Long id;
  28. private String text;
  29. private String summary;
  30. private Calendar created = Calendar.getInstance();
  31. @ManyToOne
  32. private User to;
  33. public User getTo() {
  34. return this.to;
  35. }
  36. public void setTo(User to) {
  37. this.to = to;
  38. }
  39. public Long getId() {
  40. return this.id;
  41. }
  42. public void setId(Long id) {
  43. this.id = id;
  44. }
  45. public Calendar getCreated() {
  46. return this.created;
  47. }
  48. public void setCreated(Calendar created) {
  49. this.created = created;
  50. }
  51. public String getText() {
  52. return this.text;
  53. }
  54. public void setText(String text) {
  55. this.text = text;
  56. }
  57. public String getSummary() {
  58. return this.summary;
  59. }
  60. public void setSummary(String summary) {
  61. this.summary = summary;
  62. }
  63. }