Return Multiple Types from a Single ibatis Query

╄→尐↘猪︶ㄣ 提交于 2019-12-02 06:54:35
David

After much googling, I figured out the answer to my own question.

The ibatis discriminator will pick between the gasStation and groceryStore classes.

<resultMap id="searchResultMap" class="Store">
     <discriminator column="storeType" javaType="java.lang.String">
           <subMap value="grocery" resultMap="groceryStoreMap"/>
           <subMap value="gasStation" resultMap="gasStationMap"/>
     </discriminator>
</resultMap>

I would then edit my query to add storeType in the select field and create a resultMap for the groceryStore and gasStation.

Note - to figure this out, I read this stackoverflow question.

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