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

about MyBatisPagingItemReader ibatis ExecutorType #771

Open
q3356564 opened this issue Dec 22, 2022 · 1 comment
Open

about MyBatisPagingItemReader ibatis ExecutorType #771

q3356564 opened this issue Dec 22, 2022 · 1 comment
Assignees

Comments

@q3356564
Copy link

q3356564 commented Dec 22, 2022

use MyBatisPagingItemReader is set default ExecutorType ExecutorType.BATCH

code is

  protected void doReadPage() {
    if (this.sqlSessionTemplate == null) {
          this.sqlSessionTemplate = new SqlSessionTemplate(this.sqlSessionFactory, ExecutorType.BATCH);
    }

    Map<String, Object> parameters = new HashMap();
    if (this.parameterValues != null) {
        parameters.putAll(this.parameterValues);
    }

    parameters.put("_page", this.getPage());
    parameters.put("_pagesize", this.getPageSize());
    parameters.put("_skiprows", this.getPage() * this.getPageSize());
    if (this.results == null) {
        this.results = new CopyOnWriteArrayList();
    } else {
        this.results.clear();
    }

    this.results.addAll(this.sqlSessionTemplate.selectList(this.queryId, parameters));
}

if writer is use another ExecutorType have some erro
the stack is org.springframework.dao.TransientDataAccessResourceException: Cannot change the ExecutorType when there is an existing transaction

Whether to use variables to set ExecutorType

@kazuki43zoo kazuki43zoo self-assigned this May 14, 2023
@kazuki43zoo kazuki43zoo added the enhancement Improve a feature or add a new feature label May 14, 2023
@kazuki43zoo kazuki43zoo modified the milestone: 3.0.2 May 14, 2023
@kazuki43zoo kazuki43zoo removed the enhancement Improve a feature or add a new feature label May 14, 2023
@jackyyyyyssss
Copy link

jackyyyyyssss commented Aug 11, 2023

i try to commit pr for this @kazuki43zoo

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

No branches or pull requests

3 participants