MyBatis(3.2.3) - Passing multiple input parameters
MyBatis's mapped statements have the parameterType attribute to specify the type of input parameter. If we want to pass multiple input parameters to a mapped statement, we can put all the input parameters in a HashMap and pass it to that mapped statement.
MyBatis provides another way of passing multiple input parameters to a mapped statement. Suppose we want to find students with the given name and email.
public interface StudentMapper {
List<Student> findAllStudentsByNameEmail(String name, String email);
}
MyBatis supports passing multiple input parameters to a mapped statement and referencing them using the #{param} syntax.
<select id="findAllStudentsByNameEmail" resultMap="StudentResult">
select stud_id, name,email, phone from Students where name = #{param1} and email = #{param2}
</select>
Here #{param1} refers to the first parameter name and #{param2} refers to the second parameter email.
StudentMapper studentMapper = sqlSession.getMapper(StudentMapper.class);
studentMapper.findAllStudentsByNameEmail(name, email);
MyBatis(3.2.3) - Passing multiple input parameters的更多相关文章
- doris: shell invoke .sql script for doris and passing values for parameters in sql script.
1. background in most cases, we want to execute sql script in doris routinely. using azkaban, to l ...
- C++ Templates(1.3 多模板参数 Multiple Template Parameters)
返回完整目录 目录 1.3 多模板参数 Multiple Template Parameters 1.3.1 为返回类型设置模板参数参数 Template Parameters for Return ...
- JNI: Passing multiple parameters in the function signature for GetMethodID
http://stackoverflow.com/questions/7940484/jni-passing-multiple-parameters-in-the-function-signature ...
- [Angular 2] Passing Template Input Values to Reducers
Angular 2 allows you to pass values from inputs simply by referencing them in the template and passi ...
- Mybatis异常:java.lang.NumberFormatException: For input string: "S"
MyBatis异常日志如下: Caused by: java.lang.NumberFormatException: For input string: "S" at sun.mi ...
- mybatis参数错误 Parameter '×××' not found. Available parameters are [0, 1, param1, param2]
报错的代码 @Update("update staff_info set ApplyState = #{applyState} where Id = #{userId}") int ...
- Table of Contents - MyBatis
Getting Started with MyBatis Hello World Integration with Spring Bootstrapping MyBatis Configuring M ...
- Callback<> and Bind()
Callback<> and Bind() Introduction The templated base::Callback<> class is a generalized ...
- 【译】Android API 规范
[译]Android API 规范 译者按: 修改R代码遇到Lint tool的报错,搜到了这篇文档,aosp仓库地址:Android API Guidelines. 58e9b5f Project ...
随机推荐
- hdu2248
纷菲幻剑录 之 十年一剑 Time Limit: 10000/4000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) To ...
- react-native 通常每个套接字地址(协议/网络地址/端口)只允许使用一次。
Q: A:
- Unity3D之Mecanim动画系统学习笔记(二):模型导入
我们要在Unity3D中使用上模型和动画,需要经过下面几个阶段的制作,下面以一个人形的模型开发为准来介绍. 模型制作 模型建模(Modelling) 我们的美术在建模时一般会制作一个称为T-Pose( ...
- Node.js:实现知乎(www.zhihu.com)模拟登陆,获取用户关注主题
前一段时间,在瞎看看 Node.js,便研究通过 Node.js 实现知乎模拟登陆.相信,有很多网站有登陆权限设置,如若用户未登陆,将会跳转至首页提醒用户登陆,无法浏览部分页面. 如若是 b/s 架构 ...
- iOS开发-GCD和后台处理
一些生命周期函数的调用时间 打开应用时,调用 applicationWillEnterForeground: applicationDidBecomeActive: 按Home键,调用 applica ...
- Linux下的图形界面——X Window的安装
X Window即X Windows图形用户接口,是一种计算机软件系统和网络协议,提供了一个基础的图形用户界面(GUI)和丰富的输入设备能力联网计算机.其中软件编写使用广义的命令集,它创建了一个硬件抽 ...
- 教你50招提升ASP.NET性能(二十三):StringBuilder不适用于所有字符串连接的场景;String.Join可能是
(41)StringBuilder is NOT the answer for all string concatenation scenarios; String.Join could be 招数4 ...
- 利用procdump+Mimikatz 绕过杀软获取Windows明文密码(转)
Mimikatz现在已经内置在Metasploit’s meterpreter里面,我们可以通过meterpreter下载.但是你如果觉得还要考虑杀毒软件,绑定payload之类的东西太过复杂,我们可 ...
- Hyper-V网络配置
Hyper-V虚拟交换机类型应用: 外部虚拟网络: 可以实现虚拟机之间.虚拟机和物理机.虚拟机和外部网络的通信. 生产环境不勾选“允许管理操作系统共享此网络适配器”,勾选之后会为主机创建虚拟网卡,会实 ...
- URAL 1776 C - Anniversary Firework DP
C - Anniversary FireworkTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/c ...