- 921. Minimum Add to Make Parentheses Valid 使括号有效的最少添加
- 915. Partition Array into Disjoint Intervals 分割数组
- 932. Beautiful Array 漂亮数组
- 940. Distinct Subsequences II 不同的子序列 II
Caused by: org.apache.ibatis.exceptions.PersistenceException:
## Error updating database. Cause: org.apache.shardingsphere.infra.exception.ShardingSphereException: Can not update sharding key since the updated value will change t_contract's data nodes.
## The error may exist in com/demo/module/contract/dao/ContractDao.java (best guess)
## The error may involve com.demo.module.contract.dao.ContractDao.updateById-Inline
## The error occurred while setting parameters
## SQL: UPDATE t_contract SET CONTRACT_ID=?, NAME=?, ACCOUNT=?, CREATE_TIME=?, UPDATE_TIME=? WHERE ID=?
## Cause: org.apache.shardingsphere.infra.exception.ShardingSphereException: Can not update sharding key since the updated value will change t_contract's data nodes.
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:199)
at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.lambda$updateBatchById$3(ServiceImpl.java:194)
at com.baomidou.mybatisplus.extension.toolkit.SqlHelper.lambda$executeBatch$0(SqlHelper.java:215)
at com.baomidou.mybatisplus.extension.toolkit.SqlHelper.executeBatch(SqlHelper.java:179)
... 118 common frames omitted
Caused by: org.apache.shardingsphere.infra.exception.ShardingSphereException: Can not update sharding key since the updated value will change t_contract's data nodes.
at org.apache.shardingsphere.sharding.route.engine.validator.dml.impl.ShardingUpdateStatementValidator.postValidate(ShardingUpdateStatementValidator.java:54)
at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.lambda$createRouteContext$1(ShardingSQLRouter.java:57)
at java.util.Optional.ifPresent(Optional.java:159)
at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:57)
at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:44)
at org.apache.shardingsphere.infra.route.engine.impl.PartialSQLRouteExecutor.route(PartialSQLRouteExecutor.java:73)
at org.apache.shardingsphere.infra.route.engine.SQLRouteEngine.route(SQLRouteEngine.java:53)
at org.apache.shardingsphere.infra.context.kernel.KernelProcessor.route(KernelProcessor.java:54)
at org.apache.shardingsphere.infra.context.kernel.KernelProcessor.generateExecutionContext(KernelProcessor.java:46)
at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.createExecutionContext(ShardingSpherePreparedStatement.java:431)
at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.addBatch(ShardingSpherePreparedStatement.java:500)
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.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
at com.sun.proxy.$Proxy446.addBatch(Unknown Source)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.batch(PreparedStatementHandler.java:58)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.batch(RoutingStatementHandler.java:69)
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.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)
at com.sun.proxy.$Proxy444.batch(Unknown Source)
at com.baomidou.mybatisplus.core.executor.MybatisBatchExecutor.doUpdate(MybatisBatchExecutor.java:85)
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
at com.baomidou.mybatisplus.core.executor.MybatisCachingExecutor.update(MybatisCachingExecutor.java:85)
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.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49)
at com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor.intercept(MybatisPlusInterceptor.java:83)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
at com.sun.proxy.$Proxy443.update(Unknown Source)
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.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)
at com.sun.proxy.$Proxy443.update(Unknown Source)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197)
... 121 common frames omitted
核心报错内容:Can not update sharding key since the updated value will change t_contract’s data nodes.
问题原因: update语句中涉及了分片键值的更新,更新后的键值可能会导致数据所在分片位置,所以分片键的值不可更新。
将MybatisPlus版本升级到 3.4.1
以上,在实体类的 @TableFiled
注解中增加参数:updateStrategy = FieldStrategy.NEVER
,意思是永远不更新该字段值。如下所示:
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 用户表
* </p>
*
* @author ACGkaka
* @since 2023-04-25
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("t_user")
public class User implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id")
private Long id;
/**
* 用户名
*/
@TableField("username")
private String username;
/**
* 密码
*/
@TableField("password")
private String password;
/**
* 年龄
*/
@TableField("age")
private Integer age;
/**
* 创建时间
*/
@TableField(value = "createTime", updateStrategy = FieldStrategy.NEVER)
private LocalDateTime createTime;
/**
* 更新时间
*/
@TableField("updateTime")
private LocalDateTime updateTime;
}
整理完毕,完结撒花~
我正在努力学习本教程 https://github.com/cf-platform-eng/spring-boot-cities/tree/master/cities-service在 Cloud F
0){ echo "Username or email already exists."; }else{ $query = mysql_que
我想在Linux上编译ARToolKit源码,下载源码,按照ARToolKit文档,配置GLUT , OpenGL, libjpeg 等库。 转到 ARToolKit 目录并键入 ./Configer
你好,我在这个程序中遇到错误,wcout 不是 `std' 的成员。如您所见,我也使用了 iostream,但没有用。我有 Dev-C++ 4.9.9.2,我的操作系统是 XP SP3我需要你的帮助。
我尝试对一个网站进行多次投票,但我得到: panic: runtime error: invalid memory address or nil pointer dereference [signal
当我将“ using namespace std; int main(){ string s[30]; int n = 20; for(int i = 0; i using
我设置了 EMAIL_URL process.env.MAIL_URL="smtp://xx%40gmail.com:yyy@smtp.gmail.com:465" 这个工作找到了 Email.sen
我有如下文件夹结构 . ├── docker-compose.yml └── web-app ├── create_tomcat_admin.sh ├── Dockerfile
这是我在 php 中的查询代码: $query3 = mysql_query("SELECT * FROM area_of_work") or die('Invalid query:'. mysql_
我正在尝试将 therubyracer/therubyracer-heroku 安装到我的应用程序,因为它在 heroku 服务器中不起作用,因为我没有 javascript 运行时环境。 当我尝试安
我正在开发一个非常简单的 React 应用程序。它有一个组件,在这个组件中,我试图在单击链接时设置状态。但出于某种原因,setState 甚至没有得到认可。它带有下划线,表示未解析的函数或方法 set
我有三个来源:代码处理.h typedef enum {typeBool, typeVarDeclaration, typeFuncDeclaration } nodeEnum; typedef st
我正在尝试从我的 Android 手机向 raspi 发送连续的命令。我使用了此链接中的代码,但出现错误。 链接:https://stackoverflow.com/questions/2347143
我正在尝试从数据库中加载数据并将其放入不同的 View 中。 log cat 返回错误,它找不到“_id”列。 有人可以帮我解决这个问题吗? SqlHelper代码: public class Fib
我的alertview给出了这个问题..它与sqlite无关..它给出了一些信息.. 我该如何解决这个问题? UIAlertView *infoShow = [[UIAlertView alloc]
这个问题在这里已经有了答案: launch activities from different package (5 个答案) 关闭 10 年前。 最近我一直在开发一个新的应用程序,我正在尝试使用
这是我的代码: #include #include typedef struct test { int *a; char *s; }TEST; int main (void) {
所以我定义了一个函数,如果它是由它的 lonesome 实现的,那么它非常适合对线性数组进行合并排序,但是如果我把它放到一个类中,它就会出错。我认为这是一个很好的例子,说明我不太了解类(class)的
我是 IOS 新手。我有一个示例项目,并试图在此基础上学习 Obj-C。 现在我正处于学习如何使用 UIAlertController 的阶段。我有这样的代码: if (loanAmount == 0
当我尝试使用 wincachegrind 并获取 cachegrind 文件时,它返回 Cannot find call target. cachegrind.out line number:68 有
我是一名优秀的程序员,十分优秀!