iBatis创建一个包含多个注释的数组(注释重用)
我的问候!
我是iBatis
新手,我遇到过这样的优化问题:我有两个绝对相同的@Results
,只有一个参数不同。 有没有什么办法可以创建某种注释数组来重用它来进行映射? 源代码如下:
public static interface StoreMapper { @Select("SELECT * FROM STORE WHERE STORE_NUMBER = #{storeNumber}") @Results(value = { @Result(property="storeNumber", column="STORE_NUMBER"), @Result(property="districtId", column="DISTRICT_ID"), @Result(property="managerName", column="MANAGER_NAME")}) Store findByStoreNumber (Integer storeNumber) throws FacadeException; @Select("SELECT * FROM STORE WHERE STATE = #{state}") @Results(value = { @Result(property="storeNumber", column="STORE_NUMBER"), @Result(property="districtId", column="DISTRICT_ID"), @Result(property="managerName", column="MANAGER_NAME")}) List findByState (String state) throws FacadeException; }
我读过,我可以使用XML,但是有没有办法用注释用法呢? 它们非常方便。