Advertisement
bisaggio

Untitled

Aug 17th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.02 KB | None | 0 0
  1. public class Cep implements Serializable {
  2.  
  3. private static final long serialVersionUID = 1L;
  4. @Transient
  5. private Double uid;
  6. @Id
  7. @GeneratedValue
  8. private long id;
  9. @Basic(optional = false)
  10. @Column(name = "CEP", nullable = false, unique = true)
  11. private String cep;
  12. private String bairro;
  13. private String logradouro;
  14. @Column(name = "tipo_endereco", length = 20)
  15. private String tipoEndereco;
  16. @JoinColumn(name = "id_cidade", referencedColumnName = "id", nullable = false)
  17. @ManyToOne(optional = false, fetch = FetchType.LAZY)
  18. private IbgeCidade cidade;
  19.  
  20. @Column(name = "gia_icms")
  21. private String giaIcms;
  22.  
  23. public Cep() {
  24. cidade = new IbgeCidade();
  25. this.uid = Math.random();
  26. }
  27.  
  28. #####################################################################################################
  29.  
  30. public class IbgeCidade implements Serializable {
  31.  
  32. private static final long serialVersionUID = 1L;
  33. @Transient
  34. private Double uid;
  35. @Id
  36. @Basic(optional = false)
  37. @Column(name = "id", nullable = false)
  38. @GeneratedValue
  39. private Integer id;
  40. @Column(name = "cod_IBGE")
  41. private Integer codIBGE;
  42. @Basic(optional = false)
  43. @Column(name = "nome", nullable = false, length = 255)
  44. private String nome;
  45. @Basic(optional = false)
  46. @Column(name = "tipo_cidade", nullable = false, length = 20)
  47. private String tipoCidade;
  48. @OneToMany(cascade = CascadeType.ALL, mappedBy = "cidade", fetch = FetchType.LAZY)
  49. private List<Cep> cepList;
  50. @JoinColumn(name = "UF", referencedColumnName = "UF", nullable = false)
  51. @ManyToOne(optional = false, fetch = FetchType.LAZY)
  52. private Uf uf;
  53.  
  54. #####################################################################################################
  55.  
  56. public class Uf implements Serializable {
  57.  
  58. private static final long serialVersionUID = 1L;
  59. @Transient
  60. private Double uid;
  61. @Id
  62. @Basic(optional = false)
  63. @Column(name = "UF", nullable = false, length = 2)
  64. private String uf;
  65. // @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
  66. @Column(name = "aliq_ST", precision = 22)
  67. private Double aliqST;
  68. @Basic(optional = false)
  69. @Column(name = "codigo_IBGE", nullable = false)
  70. private int codigoIBGE;
  71. @Column(name = "desconto_venda", precision = 22)
  72. private Double descontoVenda;
  73. @Column(name = "ICMS_contribuinte", precision = 22)
  74. private Double iCMSContribuinte;
  75. @Column(name = "ICMS_nao_contribuinte", precision = 22)
  76. private Double iCMSNaoContribuinte;
  77. @Basic(optional = false)
  78. @Column(name = "nome", nullable = false)
  79. private String nome;
  80. @OneToMany(cascade = CascadeType.ALL, mappedBy = "uf", fetch = FetchType.LAZY)
  81. private List<IbgeCidade> ibgeCidadeList;
  82.  
  83. public Uf() {
  84. this.uid = Math.random();
  85. }
  86.  
  87. #####################################################################################################
  88.  
  89. @Table(name = "endereco")
  90. public class Endereco extends DefaultTimeStamped implements Serializable {
  91.  
  92. private static final long serialVersionUID = 1L;
  93. @Transient
  94. private Double uid;
  95.  
  96. @Id
  97. @GeneratedValue
  98. private Long id;
  99. @JoinColumn(name = "cep_id", referencedColumnName = "id")
  100. @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
  101. private Cep cep;
  102. @Column(name = "compl_endereco")
  103. private String complEndereco;
  104. @Column(name = "num_endereco")
  105. private String numEndereco;
  106. @Column(name = "tipo_endereco")
  107. private String tipoEndereco;
  108. @Column(name = "obs")
  109. private String observacoes;
  110.  
  111. @JoinColumn(name = "id_cliente", referencedColumnName = "id", nullable = false)
  112. @ManyToOne(optional = false, fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
  113. private Cliente cliente;
  114.  
  115. public Endereco() {
  116. this.uid = Math.random();
  117. cep = new Cep();
  118.  
  119. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement