MyBatis的自定义功能
问题描述:
我MyBatis的工作,我希望写这个SQLMyBatis的自定义功能
begin;
drop table if exists production.mindia;
select * into production.mindia from staging.mindia
commit;
但只有插入,更新....标签
任何人可以帮助我吗?
答
您只需创建一个存储过程,你的SQL代码,并用select语句调用它的MyBatis并把结果在一个resultMap:
<resultMap type="State" id="resultState">
<result property="id" column="state_id"/>
<result property="name" column="state_name"/>
<result property="code" column="state_code"/>
</resultMap>
<select id="callGetStates" resultMap="resultState" statementType="CALLABLE">
{ CALL getStates()}
</select>
从Loiane Groner的博客有一些非常好的教程MyBatis(http://loianegroner.com/?s=mybatis)包括一个关于存储过程。 你应该看看这个!