RE: parametermap

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

RE: parametermap

Bhushan Bhangale

Any thoughts?

 

From: Bhushan Bhangale
Sent: Friday, October 22, 2010 8:32 AM
To: '[hidden email]'
Subject: parametermap

 

Hi,

 

I noticed that the mybatis user guides says parameterMap concept is deprecated and can be removed in future versions.

 

Not sure why as I see it’s important and serves the purpose.

 

For example –

 

I have a Person class having 20 attributes. I populate this Person object and only supply 10 attributes which means rest of the attributes will be null. Now when I try the insert I get error “Error setting null parameter.  Most JDBC drivers require that the JdbcType must be specified for all nullable parameters.”

 

If I have a parameterMap then I can define the mapping for the Person class and the above will work fine. If I don’t use parameterMap then I need to use the inline parameter mapping. But If I have parameterMap then I can reuse it in other queries also.

 

Secondly we have the concept of resultMap and there also I define mapping for Person class. Is there no way I define mapping at one place only and be able to use that both as resultMap and parameterMap.

 

Also is there any way I can define the maps as global and be able to use in multiple mappers just like typeAlias?

 

 

Thanks

Bhushan