0
I’m having a problem doing the insert
there in the Postgresql database. The code is apparently ok but time to compile the error.
The error is referring to the type of data I try to insert into the database. The error is:
error: incompatible types: java.util.Date cannot be converted to java.sql.Date
This error appears for all date insertion lines.
modeloIntenrnacao.setDtAdmisPlano((jDateChooserDtAdmissPlano.getDate()));
modeloIntenrnacao.setNome(jTextFieldNomePaciente.getText());
modeloIntenrnacao.setMatricula(Integer.parseInt(jTextFieldMatricula.getText()));
modeloIntenrnacao.setDtAdmisPlano((jDateChooserDtAdmissPlano.getDate()));
modeloIntenrnacao.setHospOrig(jTextFieldHospOrig.getText());
modeloIntenrnacao.setId(jTextFieldId.getText());
modeloIntenrnacao.setIndicacao(jTextFieldindicacao.getText());
modeloIntenrnacao.setTipoInternac((String)jComboBoxTpInterna.getSelectedItem() );
modeloIntenrnacao.setTipoLeito((String)jComboBoxTpLeito.getSelectedItem());
modeloIntenrnacao.setIdadeAprox(Integer.parseInt(jTextFieldIdadeAprox.getText()));
modeloIntenrnacao.setDataInternac((jDateChooserdDtInternac.getDate()));
modeloIntenrnacao.setDataPrevAlta((jDateChooserdInterAlt.getDate()));
modeloIntenrnacao.setObservacoes(jTextAreaObservacoes.getText());
modeloIntenrnacao.setIdCodInternac(Integer.parseInt(jTextFieldIdInternacao.getText()));
controleInterna.salvaFormInternac(modeloIntenrnacao);
Access the link to learn how to make one [mcve] and edit the question by adding it so it is possible to help you.
– user28595
Possible duplicate of: Convert java.util.date to java.sql.Date
– user28595