Home > Database > Mysql Tutorial > MyIbatis调用Oracle存储过程

MyIbatis调用Oracle存储过程

WBOY
Release: 2016-06-07 17:03:16
Original
1516 people have browsed it

1、xml文件 lt;select id=getGroupNum statementType=CALLABLE parameterType=com.guorui.model.ParamSPCgt;{call GYL_C

1、xml文件

















2、parameter bean

public class ParamSPC {

String IN_PARAMETERID;
String IN_STEELID;
Integer OUT_GN;
List RST;

public String getIN_PARAMETERID() {
return IN_PARAMETERID;
}
public void setIN_PARAMETERID(String iN_PARAMETERID) {
IN_PARAMETERID = iN_PARAMETERID;
}
public String getIN_STEELID() {
return IN_STEELID;
}
public void setIN_STEELID(String iN_STEELID) {
IN_STEELID = iN_STEELID;
}
public Integer getOUT_GN() {
return OUT_GN;
}
public void setOUT_GN(Integer oUT_GN) {
OUT_GN = oUT_GN;
}
public List getRST() {
return RST;
}
public void setRST(List rST) {
RST = rST;
}

}

3、xxxMaper.java 中的方法

Object getGroupNum(ParamSPC param);

4、使用demo


SqlSession session = AllSqlMap.getInstance().openSession();

try {
TbSysUserMapper mapper = session.getMapper(TbSysUserMapper.class);
ParamSPC param = new ParamSPC();
param.setIN_PARAMETERID("010401"); // 填充 in 参数,,out 参数不用任何处理
param.setIN_STEELID("65Mn棒带");
mapper.getGroupNum(param);
System.out.println(param.getOUT_GN()); // 获取计算结果
System.out.println(param.getRST().size());

session.commit(true);
} catch(Exception e){
e.printStackTrace();
session.rollback(true);
} finally {
session.close();
}

linux

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template