Advertisement
Guest User

JAVA

a guest
Feb 22nd, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. import java.io.Serializable;
  2. import java.math.BigDecimal;
  3. import java.sql.Date;
  4.  
  5. import javax.persistence.Column;
  6. import javax.persistence.Entity;
  7. import javax.persistence.GeneratedValue;
  8. import javax.persistence.GenerationType;
  9. import javax.persistence.Id;
  10.  
  11. @JsonInclude
  12. @Entity
  13. public class Gasto implements Serializable {
  14.  
  15. private static final long serialVersionUID = 1892915971510890201L;
  16.  
  17. @JsonInclude(Include.NON_NULL) // Nao deixa aparecer valores nulos
  18. @Id
  19. @GeneratedValue(strategy = GenerationType.AUTO)
  20. private Long idGasto;
  21.  
  22. @JsonInclude(Include.NON_NULL)
  23. @Column(nullable = false, length = 50)
  24. private String nomePessoa;
  25.  
  26.  
  27. @JsonInclude(Include.NON_NULL)
  28. @Column(length = 100)
  29. private String descricao;
  30.  
  31. @JsonInclude(Include.NON_NULL)
  32. @JsonFormat(pattern = "dd/MM/yyyy")
  33. private Date dataHora;
  34.  
  35. @JsonInclude(Include.NON_NULL)
  36. @Column(nullable = false, length = 50)
  37. private BigDecimal valor;
  38.  
  39. @JsonInclude(Include.NON_NULL)
  40. @Column(length = 150)
  41. private String tags;
  42.  
  43. @JsonInclude
  44. public Gasto() {
  45.  
  46. }
  47.  
  48.  
  49.  
  50. Impors para o SEU POM XML
  51.  
  52.  
  53. <dependency>
  54. <groupId>com.fasterxml.jackson.dataformat</groupId>
  55. <artifactId>jackson-dataformat-xml</artifactId>
  56. </dependency>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement