Mysql外键
<pre name="code" class="java">//暂时关闭mysql的外键检查功能,FOREIGN_KEY_CHECKS=0,表示不检查外键String closeForeignKey = "SET @ORIG_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0";Integer close = jdbcTemplate.update(closeForeignKey);//执行自己的sql语句String branchSql = "insert into scpn_branchinfo (branch_id,branch_code,branch_name,branch_secretary,contact_person,branch_create_time,branch_address,email,telephone,office_phone,create_time) values ("+presentId+",'"+maxCode+"', '"+branchinfo.getBranchName()+"', '"+branchinfo.getBranchSecretary()+"', '"+branchinfo.getContactPerson()+"', '"+branchCreateTime+"', '"+branchinfo.getBranchAddress()+"','"+branchinfo.getEmail()+"','"+branchinfo.getTelephone()+"','"+branchinfo.getOfficePhone()+"','"+currentTime+"')";jdbcTemplate.update(branchSql); //打开mysql的外键检查功能,FOREIGN_KEY_CHECKS=1,表示检查外键closeForeignKey = "SET @ORIG_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=1";Integer open = jdbcTemplate.update(closeForeignKey);