ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shannon, Bryan" <BShan...@Tribune.com>
Subject RE: ResultMap columns as a superset of select columns
Date Thu, 25 Sep 2008 19:05:06 GMT
You can alias your columns in your select.


 Select foo as cd_entity, bar as nm_entity from table

iBatis will use the alias to map the results in the resultMap.

-----Original Message-----
From: Daniel Henrique Alves Lima [mailto:email_daniel_h@yahoo.com.br] 
Sent: Thursday, September 25, 2008 2:32 PM
To: user-java@ibatis.apache.org
Subject: ResultMap columns as a superset of select columns

	Hi everybody. First of all: I'm sorry for my bad English.

	How can define just one resultMap with all necessary columns and
reuse it in selects with different columns ?
	Something like this:

   <resultMap id="EntityMap" class="Entity">
     <result property="code" column="cd_entity" />
     <result property="name" column="nm_entity" />
   </resultMap>

   <select id="selectAllEntities" resultMap="EntityMap">
     select * from entity
   </select>

   <select id="selectAllEntitiesCodes" resultMap="EntityMap">
     select cd_entity from entity
   </select>


	Can I implement/extend some of the IBatis' interfaces and
classes to achieve this ?


	Thanks in advance !



Mime
View raw message