iBatis create an array of multiple annotations (annotation reuse)

删除回忆录丶 提交于 2019-12-05 05:17:16

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!