Home > Database > Mysql Tutorial > ibatis sqlserver 存储过程

ibatis sqlserver 存储过程

WBOY
Release: 2016-06-07 15:40:42
Original
1517 people have browsed it

ibatis调用sqlserver存储过程: order.xml ?xml version=1.0 encoding=UTF-8?!DOCTYPE sqlMapPUBLIC -//iBATIS.com//DTD SQL Map 2.0//ENhttp://www.ibatis.com/dtd/sql-map-2.dtdsqlMaptypeAlias alias=order type=com.xinrui.pojo.Order /parameterMap id=

ibatis调用sqlserver存储过程:

order.xml

<?xml version="1.0" encoding="UTF-8"?>

<sqlmap>
	<typealias alias="order" type="com.xinrui.pojo.Order"></typealias>

	<parametermap id="ParaMap_order" class="order">
		<parameter property="pid" mode="IN" javatype="java.lang.Integer" jdbctype="int"></parameter>
		<parameter property="price" mode="IN" javatype="java.lang.Double" jdbctype="varchar"></parameter>
		<parameter property="nums" mode="IN" javatype="java.lang.Integer" jdbctype="int"></parameter>
		<parameter property="unit" mode="IN" javatype="java.lang.String" jdbctype="varchar"></parameter>
		<parameter property="notes" mode="IN" javatype="java.lang.String" jdbctype="varchar"></parameter>
		<parameter property="proid" mode="IN" javatype="java.lang.Integer" jdbctype="int"></parameter>
	</parametermap>	

	<procedure id="addOrders" parametermap="ParaMap_order">
		
	</procedure>
</sqlmap>
Copy after login

action的function
public String submit_orders() {
		HttpServletRequest request = ServletActionContext.getRequest();
		Order o = new Order();
		o.setPid(10000);
		o.setNotes("aaaaaaaaaaaaaaa");
		o.setNums(121);
		o.setPrice(123.123);
		o.setUnit("bbbbbbbbbbbbbb");
		o.setProid(10000);
		orderService.addOrders(o);
		return new Constant().SUBMITING;
}
Copy after login

备注:

1.order.xml中,中的?与parameterMap中的parameter顺序相同;

2.javaType为pojo中的变量属性,jdbcType为数据库中对应字段属性;



Related labels:
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