Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CommandTimeout on a statement basis #29

Open
GoogleCodeExporter opened this issue Mar 30, 2015 · 1 comment
Open

CommandTimeout on a statement basis #29

GoogleCodeExporter opened this issue Mar 30, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What version of the MyBatis.NET are you using?
IBatisNet.DataMapper.dll (version 1.6.2)
IBatisNet.DataAccess.dll (version 1.9.2)

Issue:

Hello we've got very big problem with timeout expiring often when using Ibatis 
with long transactions.

I realized that SqlMapper methods (QueryForObject<T>, etc) ultimately rely on 
SqlMapSession.CreateCommand
and that method is the one setting the commandTimeout on the command.

My methods use code like this:

protected T Select(string statementName, object parameterObject)
{
    IDaoManager daoManager = DaoManager.GetInstance(this);
    SqlMapDaoSession sqlMapDaoSession = (SqlMapDaoSession)daoManager.LocalDaoSession;
    ISqlMapper mapper = sqlMapDaoSession.SqlMap;
    return mapper.QueryForObject<T>(statementName, parameterObject);
}


How can I change them to be able to set the CommandTimeout.
I saw that almost all the methods are public so I guess it should be possible.

Could you give me any advice or code snippet?
I know that the connection timeout is copied to the command timeout but
changing the connection timeout in the connection string is not viable for us
because we cannot increase the timeout in the whole application.

Thank you very much for your help



Original issue reported on code.google.com by [email protected] on 8 Apr 2011 at 10:33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant