Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Cep implements Serializable {
- private static final long serialVersionUID = 1L;
- @Transient
- private Double uid;
- @Id
- @GeneratedValue
- private long id;
- @Basic(optional = false)
- @Column(name = "CEP", nullable = false, unique = true)
- private String cep;
- private String bairro;
- private String logradouro;
- @Column(name = "tipo_endereco", length = 20)
- private String tipoEndereco;
- @JoinColumn(name = "id_cidade", referencedColumnName = "id", nullable = false)
- @ManyToOne(optional = false, fetch = FetchType.LAZY)
- private IbgeCidade cidade;
- @Column(name = "gia_icms")
- private String giaIcms;
- public Cep() {
- cidade = new IbgeCidade();
- this.uid = Math.random();
- }
- #####################################################################################################
- public class IbgeCidade implements Serializable {
- private static final long serialVersionUID = 1L;
- @Transient
- private Double uid;
- @Id
- @Basic(optional = false)
- @Column(name = "id", nullable = false)
- @GeneratedValue
- private Integer id;
- @Column(name = "cod_IBGE")
- private Integer codIBGE;
- @Basic(optional = false)
- @Column(name = "nome", nullable = false, length = 255)
- private String nome;
- @Basic(optional = false)
- @Column(name = "tipo_cidade", nullable = false, length = 20)
- private String tipoCidade;
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "cidade", fetch = FetchType.LAZY)
- private List<Cep> cepList;
- @JoinColumn(name = "UF", referencedColumnName = "UF", nullable = false)
- @ManyToOne(optional = false, fetch = FetchType.LAZY)
- private Uf uf;
- #####################################################################################################
- public class Uf implements Serializable {
- private static final long serialVersionUID = 1L;
- @Transient
- private Double uid;
- @Id
- @Basic(optional = false)
- @Column(name = "UF", nullable = false, length = 2)
- private String uf;
- // @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
- @Column(name = "aliq_ST", precision = 22)
- private Double aliqST;
- @Basic(optional = false)
- @Column(name = "codigo_IBGE", nullable = false)
- private int codigoIBGE;
- @Column(name = "desconto_venda", precision = 22)
- private Double descontoVenda;
- @Column(name = "ICMS_contribuinte", precision = 22)
- private Double iCMSContribuinte;
- @Column(name = "ICMS_nao_contribuinte", precision = 22)
- private Double iCMSNaoContribuinte;
- @Basic(optional = false)
- @Column(name = "nome", nullable = false)
- private String nome;
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "uf", fetch = FetchType.LAZY)
- private List<IbgeCidade> ibgeCidadeList;
- public Uf() {
- this.uid = Math.random();
- }
- #####################################################################################################
- @Table(name = "endereco")
- public class Endereco extends DefaultTimeStamped implements Serializable {
- private static final long serialVersionUID = 1L;
- @Transient
- private Double uid;
- @Id
- @GeneratedValue
- private Long id;
- @JoinColumn(name = "cep_id", referencedColumnName = "id")
- @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
- private Cep cep;
- @Column(name = "compl_endereco")
- private String complEndereco;
- @Column(name = "num_endereco")
- private String numEndereco;
- @Column(name = "tipo_endereco")
- private String tipoEndereco;
- @Column(name = "obs")
- private String observacoes;
- @JoinColumn(name = "id_cliente", referencedColumnName = "id", nullable = false)
- @ManyToOne(optional = false, fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
- private Cliente cliente;
- public Endereco() {
- this.uid = Math.random();
- cep = new Cep();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement