问题
My greetings!
I am pretty new to iBatis
and I have faced such kind of optimization problem: I have two absolutely identical @Results
with just 1 parameter in difference. Is there any way I could create some sort of annotation-array to reuse it for mapping? The source looks like that:
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;
}
I read, that I could use XML, but is there a way to do it with annotation usage? They are pretty handy.
来源:https://stackoverflow.com/questions/14195155/ibatis-create-an-array-of-multiple-annotations-annotation-reuse