MyBatis-batch | 基于 MyBatis 执行 SQL 批量操作的插件 | Object-Relational Mapping library
kandi X-RAY | MyBatis-batch Summary
kandi X-RAY | MyBatis-batch Summary
基于 MyBatis 执行 SQL 批量操作的插件
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Intercept an invocation
- Execute a batch statement
- Gets the value of the field with the given name
- Determine the type of KeyGenerator
- Sets value
- Find a field by its field name
- Extracts the generated keys from a ResultSet
- Returns the number of affected rows
- PreGenerate key
- Adds row counts
- Gets the number of batches
- Returns the list of data
- Sets value by field name
- Wrap plugin with target object
MyBatis-batch Key Features
MyBatis-batch Examples and Code Snippets
Community Discussions
Trending Discussions on MyBatis-batch
QUESTION
I'm updating huge amount of data by passing a variable List in MyBatis to Oracle DB.
Methods from this link are not efficient enough for me, the ways to commit update sql query line by line, for loop in sql query or Executor.batch service are way too slow from what I expect.
...ANSWER
Answered 2019-Jun-09 at 13:40Using batch executor is the recommended way, but you need to do it properly.
Two issues that I noticed.
- Setting a proper batch size is important. The linked answer sends all the data at the end which is not efficient very much.
- Using
${}
to reference parameters makes each statement unique and prevents the driver from reusing the statement (the benefit of batch executor is lost, basically). See this FAQ for the difference between#{}
and${}
.
Here is a typical batch operation using MyBatis.
As the best batchSize
depends on various factors, you should measure the performance using the actual data.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install MyBatis-batch
You can use MyBatis-batch like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the MyBatis-batch component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page