5
Yes. First you enter the parent table (tbPessoa) and then the daughter table (tbPessoaFisica or tbPessoaJuridica).
INSERT INTO tbPessoa ('nmPessoa', 'dsEmail')
VALUES ('João', '[email protected]');
INSERT INTO tbPessoaFisica ('cdCpf', 'idPessoa')
VALUES ('78945698745', 'pk do insert de cima');
In the case of the method that will do the Insert will have two sql string =
– Christopher Dopona
and will have two pst.execute();? or one only?
– Christopher Dopona
Since you use JDBC, you’ll get two Sqls. Take a look at this link: https://javahunter.wordpress.com/2011/03/23/use-of-prepared-statement-and-getting-foriegn-key-from-master-table/
– karanalpe
All right, thank you
– Christopher Dopona
Insert worked fine, but now I can use this logic to update my client right?
– Christopher Dopona
Exact. Use the same logic. :)
– karanalpe
All right, thank you so much for your help.
– Christopher Dopona