to all developer:
写sql、hql都不要直接拼参数(不管有几个参数),用占位符预编译传参;
直接拼参数,1.容易错(拼字符串参数忘了单引号)2.不能防注入;
"select xx from tbl where id="+id (错误)
"select xx from tbl where id=?" (正确)写sql、hql都不要直接拼参数(不管有几个参数),用占位符预编译传参;
直接拼参数,1.容易错(拼字符串参数忘了单引号)2.不能防注入;
"select xx from tbl where id="+id (错误)
"select xx from tbl where id=?" (正确)