I am building a Spring application and in my Repository I have to insert an sql query that has 5 parameters and I tried jdbcTemplate.query or queryForList or Map but it gives me error.
Here is the code:
@Repository
public class BilantErrRepository {
@Autowired
private DataSource dataSourceMail;
public List<BilantErr> search() {
List<BilantErr> info1 = new ArrayList<>();
BilantErr bilant = new BilantErr();
JdbcTemplate jdbcTemplate = new JdbcTemplate(this.dataSourceMail);
String sql = "INSERT into Aaa (cui,an, data_autorizare,operator,motivatie, tip_perioada) VALUES (?,?,sysdate,?,?,?)";
info1 = jdbcTemplate.query(sql, bilant.getCui(),bilant.getAn(),bilant.getOperator(),bilant.getOperator(),bilant.getPerioada());
return info1;
}
}
What method can I use to do this insert ? Thanks