-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
sharding-jdbc5.0 batch insert do not return primary id #14580
Comments
@zhao190775705 Can you provide your configuration? |
Not a sub-table, a normal table, does not return the primary key ID |
Can I add wechat |
Sharding configuration, thx. |
1. sharding config version 5.0.0
2. mybatis config
3. sql
4. error
Normal,mybatis is configured like this to return the id value of the parameter project-demo https://github.com/zhao190775705/sharding-demo |
@ZjcNB |
I will check. |
@zhao190775705 Hello, Can you adjust your
|
Thank you. I've taken care of it |
@zhao190775705 Hello, is the issue resolved? |
Closed because of no response for long time. |
error--------
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorException: Error getting generated key or setting result to parameter object. Cause: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column #1 from result set. Cause: java.lang.NullPointerException: ResultSet should call next or has no more data.
Caused by: org.apache.ibatis.executor.ExecutorException: Error getting generated key or setting result to parameter object. Cause: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column #1 from result set. Cause: java.lang.NullPointerException: ResultSet should call next or has no more data.
at org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator.processBatch(Jdbc3KeyGenerator.java:88)
at org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator.processAfter(Jdbc3KeyGenerator.java:71)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:51)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50)
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:194)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:427)
... 35 more
Caused by: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column #1 from result set. Cause: java.lang.NullPointerException: ResultSet should call next or has no more data.
at org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:96)
at org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator$KeyAssigner.assign(Jdbc3KeyGenerator.java:270)
at org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator.lambda$assignKeysToParamMap$3(Jdbc3KeyGenerator.java:170)
at java.util.ArrayList.forEach(ArrayList.java:1259)
at org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator.assignKeysToParamMap(Jdbc3KeyGenerator.java:170)
at org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator.assignKeys(Jdbc3KeyGenerator.java:97)
at org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator.processBatch(Jdbc3KeyGenerator.java:85)
... 48 more
Caused by: java.lang.NullPointerException: ResultSet should call next or has no more data.
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:805)
at org.apache.shardingsphere.driver.jdbc.core.resultset.GeneratedKeysResultSet.checkStateForGetData(GeneratedKeysResultSet.java:243)
at org.apache.shardingsphere.driver.jdbc.core.resultset.GeneratedKeysResultSet.getInt(GeneratedKeysResultSet.java:131)
at org.apache.ibatis.type.IntegerTypeHandler.getNullableResult(IntegerTypeHandler.java:44)
at org.apache.ibatis.type.IntegerTypeHandler.getNullableResult(IntegerTypeHandler.java:26)
at org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:94)
... 54 more
mybatis xml--
insert into crm_bidding
(id, project_code, project_title,
project_date, purchaser_url, purchaser,
update_id, update_time,
create_time, creator_id, note,project_phase,project_period_start,
project_period_end,province_id,project_address,type,company_name,amount_invested,project_title_hash
)
values
(#{item.id,jdbcType=INTEGER}, #{item.projectCode,jdbcType=VARCHAR}, #{item.projectTitle,jdbcType=VARCHAR},
#{item.projectDate,jdbcType=DATE}, #{item.purchaserUrl,jdbcType=VARCHAR}, #{item.purchaser,jdbcType=VARCHAR},
#{item.updateId,jdbcType=INTEGER}, #{item.updateTime,jdbcType=TIMESTAMP},
#{item.createTime,jdbcType=TIMESTAMP}, #{item.creatorId,jdbcType=INTEGER}, #{item.note,jdbcType=VARCHAR},
#{item.projectPhase,jdbcType=VARCHAR}, #{item.projectPeriodStart,jdbcType=VARCHAR}, #{item.projectPeriodEnd,jdbcType=VARCHAR},
#{item.provinceId,jdbcType=INTEGER}, #{item.projectAddress,jdbcType=VARCHAR},#{item.type,jdbcType=INTEGER},#{item.companyName,jdbcType=VARCHAR},
#{item.amountInvested,jdbcType=DOUBLE}, #{item.projectTitleHash,jdbcType=INTEGER})
英文不好,见谅。
The text was updated successfully, but these errors were encountered: