2 回答
TA贡献1828条经验 获得超3个赞
我认为您不能同时运行这两个:
if(null != jdbcTemplate) {
// Performing The Sql 'Insert' Operation
String sql = "insert into patient(id_patient, description) values(?,?);" +
"insert into attachment(id_data, file_data, patientID) values (?, ?, (select patientID from patient where patientID = id_patient));";
jdbcTemplate.update(sql, patient.getDescription(), attachment.getId_data(), attachment.getData(), attachment.getPatientID());
也许尝试:
if(null != jdbcTemplate) {
// Performing The Sql 'Insert' Operation
String sql = "insert into patient(id_patient, description) values(?,?);";
String sqlTwo = "insert into attachment(id_data, file_data, patientID) values (?, ?, (select patientID from patient where patientID = id_patient));";
jdbcTemplate.update(sql, patient.getDescription(), attachment.getId_data(), attachment.getData(), attachment.getPatientID());
jdbcTemplate.update(sqlTwo, patient.getDescription(), attachment.getId_data(), attachment.getData(), attachment.getPatientID());
还
您不能使用嵌套子查询绑定参数:
values (?, ?, (select patientID from patient where patientID = id_patient))
添加回答
举报