customize/overide configuration parameters for single mybatis session

18 views
Skip to first unread message

kate

unread,
Dec 20, 2010, 5:13:14 AM12/20/10
to mybatis-user
Hi

Is it possible to customize configuration parameter for only one
mybatis session or result mapping?
I have global configuration for my application with automapping
behavior set to NONE but in specyfic case I need
this feature to be set on FULL or PARTIAL (with automapping set to
NONE mapping with maps doesn't work),
I can do this by
session.getConfiguration().setAutoMappingBehavior(AutoMappingBehavior.FULL)
and after my job is done set back to AutoMappingBehavior.NONE. It's
not good solution because in the same time other session can process
with changed configuration which is shared globally.

Clinton Begin

unread,
Dec 31, 2010, 8:49:49 PM12/31/10
to mybati...@googlegroups.com
Yeah, you've answered your own question correctly. 

There's no way to do this safely on a per-session basis.  But I'd worry about that regardless... By definition the result mappings should be deterministic and consistent.  They shouldn't really change on a per-request basis. 

That said, if auto-mapping is enabled, and you simply leave out the columns that you don't want mapped (using dynamic SQL), that might work....  but it won't be pretty.

Cheers,
Clinton
Reply all
Reply to author
Forward
0 new messages