Search code examples
sqlibatis

ibatis return values


I'm currently using ibatis to returns some pojos and everything works great.
My question is: I have to return 1 row from a table, just like 3 fields, and I don't want to create a pojo for it. I just want to run the query and get the 3 values. Is there any easy way to do this without create a special java object just for this?


Solution

  • in IBatis.NET we use Hashtable when we need more than one value from a query.

    <resultMap id="ResultMap1"  class="Hashtable"> 
          <result column="FirstName" property="FirstName" type="string" /> 
              <!-- shows up as "FirstName"  in the Hashtable --> 
          <result column="LastName" property="LastName" type="string" /> 
              <!-- shows up as "LastName"  in the Hashtable --> 
    </resultMap>