4
I am creating a registration modeling in the most comprehensive way possible. Entities are Person, Natural Person, Legal Entity, Supplier and Customer
Below the entity person. I add the person the contact data and address to facilitate future queries.
public class Pessoa {
private String ativo;
private String apelido;
private Endereco endereco;
private String dataAtualizacao;
private String foneResidencial;
private String nome;
private String foneCelular;
private String foneProfissional;
private String sexo;
private String dataNascimento;
private String dataCadastro;
private String email;
}
Pessoa Tisica is quiet:
public class PessoaFisica {
private String estadoEmissor;
private Pessoa pessoa;
private String RG;
private String orgaoEmissor;
private String dataAtualizacao;
private String paisNascimento;
private String CPF;
private Profissao profissao;
private String localNascimento;
private String estadoNascimento;
private EstadoCivil estadoCivil;
}
Legal Person is also quiet:
public class PessoaJuridica extends EntidadeAbstrata implements Serializable {
private String nomeFantasia;
private Pessoa pessoa;
private String Razao;
private String CNPJ;
}
What is complicating for me is to understand Customer and Supplier.
First, which attributes would differentiate them within the base?
And what I find most difficult is: as mine Cliente
or Fornecedor
could be PessoaFisica
or PessoaJuridica
being within the same table.
/********UPDATING********/
When I asked the question I confessed that I was not entirely sure what I was asking. I’ll explain my 'giric' idea better'.
I am trying to create a comprehensive registration model not in the sense of having a model ready and that is fully applied to any business, but in the sense of always having a starting point for any system that I develop. I do not deny that it is a desire a little crazy, masssss
When I asked the question related to Customer and Supplier I did it because when it comes to Person or Legal the thing is clearer, at least for me.
Person Physical CPF, RG, Marital Status etc Legal Person Reason, CNPJ, State Registration etc
When asked about customer/supplier I thought that someone with more experience would identify attributes for these entities more easily.
Anyway, I’m open to ideas and criticism. Let’s see what comes
Thanks!
I do not know if I understood your question. Clarify me better so I can post an answer. How difficult it is to create tables
Cliente
andFornecedor
? They will have a field that binds to a natural or legal person exclusively, after all a person can only be one of them. I just found it kind of strange the inconsistency between the two people, much less understood what this isEntidadeAbstrata
.– Maniero
@bigown Is it the case of a Foreign key plus a discrimination column? Or is there any other solution.
– Krismorte
That may be, but I don’t know what you mean by
descriminação
.– Maniero
An example type column: 'PF' or 'PJ'
– Krismorte
The information you pass is very truncated, so any statement I make could be right or wrong. It should have a column like this, but it depends. There are other things that need to be better defined. This should go into a database which will require a primary key. Going or not, it would be interesting to have information to give uniqueness to the data. How is this being done? I could go further and ask how these classes will be used in the system, it may be that this whole model is wrong, but I don’t even want to get into it now.
– Maniero
That’s actually it. I’m trying to create the most comprehensive modeling possible. For example, in this first version
Pessoa Jurifica
references a person, but then I ask myself this right? It makes sense?– Krismorte
Did any of the answers solve your problem? Do you think you can accept one of them?
– Maniero