我的问候!
我对iBatis
很新,我遇到了这样的优化问题:我有两个绝对相同的@Results
只有1个参数。有没有什么办法可以创建某种注释数组来重用它来进行映射?来源看起来像这样:
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<Store> findByState (String state) throws FacadeException;
}
我读过,我可以使用XML,但有没有办法使用注释用法?它们非常方便。