I'm creating a form in JFrame to insert data into a table that contains two foreign keys (these keys are not automatically generated).
What do I have to put in the insert to get the foreign keys?
public void inserir(Tratamento tratamento) {
try{
try (Connection conexao = getConexao(); PreparedStatement stmt = conexao.prepareStatement("insert into tratamento "
+ "(codigo_tratamento, titulo, descricao) "
+ "values (?,?,?)")) {
stmt.setString(1, tratamento.getCodigo_tratamento());
stmt.setString(2, tratamento.getTitulo());
stmt.setString(3, tratamento.getDescricao());
stmt.execute();
}
}catch(SQLException e){
}
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}