You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by sadasiva lingala <sa...@yahoo.com> on 2006/03/26 16:19:13 UTC

need help - custom result set with no mapping

Hi 
I am using Spring and Ibatis for database access. I need a solution for defining custom type handler for entire resultset.

for example I have SQL like 
"Select abc, xyz from table_a"

I need to map the above query results to a generic Custom result set using JDBC resultset metadata. So I don't have a domain object to map the results , instead I want to map the results to custom resultset which also contains meta data. I see an example to map Oracle cursor data to a JSTL Result object using a type handler. But I am not sure how to map results from above SQL to a custom resultset using a type handler or some other mechanism. I know how to write a type handler but not sure how the resultMap would look like for this as I am not mapping individual columns but just want to call type handler for entire result set. This type handler should convert the JDBC result set into custom resultset. 
for example I want my query mapping something like this.. customer data has to be stored in CustomResult object along with metadata.

<resultMap class="CustomResult" id="custom_result">
</resultMap>

<select id="getallcustomers" resultMap="custom_result" >
select cust_name, age, address from customers
</select>

I also would take an alternative solution not using type handler (But I have to use ibatis as I am already using it for other things). 

  Thanks

Re: need help - custom result set with no mapping

Posted by Larry Meadors <lm...@apache.org>.
Sounds like a good time to use JDBC.

Larry


On 3/26/06, sadasiva lingala <sa...@yahoo.com> wrote:
>
> Hi
> I am using Spring and Ibatis for database access. I need a solution for
> defining custom type handler for entire resultset.
>
> for example I have SQL like
> "Select abc, xyz from table_a"
>
> I need to map the above query results to a generic Custom result set using
> JDBC resultset metadata. So I don't have a domain object to map the results
> , instead I want to map the results to custom resultset which also contains
> meta data. I see an example to map Oracle cursor data to a JSTL Result
> object using a type handler. But I am not sure how to map results from above
> SQL to a custom resultset using a type handler or some other mechanism. I
> know how to write a type handler but not sure how the resultMap would look
> like for this as I am not mapping individual columns but just want to call
> type handler for entire result set. This type handler should convert the
> JDBC result set into custom resultset.
> for example I want my query mapping something like this.. custo mer data has
> to be stored in CustomResult object along with metadata.
>
> <resultMap class="CustomResult" id="custom_result">
> </resultMap>
>
> <select id="getallcustomers" resultMap="custom_result" >
> select cust_name, age, address from customers
> </select>
>
> I also would take an alternative solution not using type handler (But I have
> to use ibatis as I am already using it for other things).
>
> Thanks