can we assign a string to a column directly in the resultMap association?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

can we assign a string to a column directly in the resultMap association?

w agamem
like this:
<association property="favorite" column="{vehicleType='car'}" select="queryVehicle"/>

the 'car' is a string, and i get error:
org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'car' from result set.

is there some way to assign a string to the column directly?

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/38bf1af5-cd61-49fb-afc5-3e1e45af4b81%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: can we assign a string to a column directly in the resultMap association?

Guy Rouillier-2
You can assign a constant value to a result in your SQL statement:

    select make, model, 'car' as vehicleType
    from auto_products
    ...

You can't do an assignment in the column attribute as you show below.  That attribute needs to refer to a column name.

--
Guy Rouillier

On 10/26/2019 4:11:42 AM, "w agamem" <[hidden email]> wrote:

like this:
<association property="favorite" column="{vehicleType='car'}" select="queryVehicle"/>

the 'car' is a string, and i get error:
org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'car' from result set.

is there some way to assign a string to the column directly?

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/38bf1af5-cd61-49fb-afc5-3e1e45af4b81%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/emffea74ab-1ace-45c1-8572-dd3d20863e53%40asus.