Can someone point out any mistake in my following code of Spring Jdbc Template?
When I click delete, the record is not getting deleted and there are no errors showing.
public void delete(String id) {
logger.debug("Deleting existing person");
// Prepare our SQL statement using Unnamed Parameters style
String query = "delete from person where id = ?";
// Assign values to parameters
Object[] person = new Object[] {id};
// Delete
jdbcTemplate.update(query, person);
}
Here is an example. Pay attention:
Integer id
public boolean delete(Integer id){
String sql = "DELETE FROM organization WHERE id = ?";
Object[] args = new Object[] {id};
return jdbcTemplate.update(sql, args) == 1;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With