Skip to content

insert/update always return negative update/affected counts when ExecutoryType is BATCH #533

@rigofunc

Description

@rigofunc

If create SqlSessionTemplate bean with ExecutorType.BATCH, the insert/delete/update always return negative update/affected counts

@Bean
    public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception {
        SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();
        factoryBean.setDataSource(dataSource);
        return factoryBean.getObject();
    }

    @Bean
    public SqlSessionTemplate sqlSessionTemplate(SqlSessionFactory sqlSessionFactory) {
        return new SqlSessionTemplate(sqlSessionFactory, ExecutorType.BATCH);
  }

When I debugging, I found out the BatchExecutor executing result is correct, updateCounts==1, as following:

image

But when I debugging into SqlSessionTemplate, the result is -2147482646

image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions