2013-10-28 153 views
2

我MyBatis的工作,我希望寫這個SQLMyBatis的自定義功能

begin; 
    drop table if exists production.mindia; 
    select * into production.mindia from staging.mindia 
commit; 

但只有插入,更新....標籤

任何人可以幫助我嗎?

回答

0

您只需創建一個存儲過程,你的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)包括一個關於存儲過程。 你應該看看這個!