- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
以下使用Spring Boot,Hibernate,JpaRepository,CockroachDB和Kotlin的最小CRUD示例生成org.springframework.orm.jpa.JpaSystemException
/ org.hibernate.TransactionException
。
有问题的Thing
实体只有两个字段:
@Entity
data class Thing (
@Id
var id: Long,
var value: String
)
./src/main/kotlin/ThingService.kt
./src/main/resources/application.properties
./build.gradle.kts
./stress_test.py
# download
wget -qO- https://binaries.cockroachdb.com/cockroach-v1.1.5.linux-amd64.tgz | tar xvz
# start
./cockroach-v1.1.5.linux-amd64/cockroach start --insecure
# leave terminal open in background
# init
cockroach sql --insecure -e "CREATE USER root WITH PASSWORD '123';"
cockroach sql --insecure -e "CREATE DATABASE things_db;"
cockroach sql --insecure -e "GRANT ALL ON DATABASE things_db TO root;"
gradle bootRun
# leave terminal open in background
python3 stress_test.py
stress_test.py
同时向服务发送
PUT
请求和
GET
请求(按值查找)。大多数请求都可以正常工作,但是在两者之间的输出如下所示:
PUT OK
find OK
PUT OK
find OK
find OK
find OK
PUT ERROR: {"timestamp":"2018-03-17T16:00:24.616+0000","status":500,"error":"Internal Server Error","message":"Unable to commit against JDBC Connection; nested exception is org.hibernate.TransactionException: Unable to commit against JDBC Connection","path":"/thing/"}
find OK
PUT OK
2018-03-17 17:00:24.615 ERROR 3547 --- [nio-8082-exec-6] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.orm.jpa.JpaSystemException: Unable to commit against JDBC Connection; nested exception is org.hibernate.TransactionException: Unable to commit against JDBC Connection] with root cause
org.postgresql.util.PSQLException: ERROR: restart transaction: HandledRetryableTxnError: TransactionRetryError: retry txn (RETRY_SERIALIZABLE): "sql txn" id=1cb57665 key=/Table/51/1/11125601/0 rw=true pri=0.04354217 iso=SERIALIZABLE stat=PENDING epo=0 ts=1521302424.604752770,1 orig=1521302424.604725980,0 max=1521302424.604725980,0 wto=false rop=false seq=3
最佳答案
HandledRetryableTxnError表示transaction should be retried。当在事务之间检测到冲突时,这种情况发生在SERIALIZABLE
隔离级别。
蟑螂会自动重试一些,但不是全部重试,需要客户的参与。
您可以在docs site(包括java)上找到多种语言的客户端重试示例。
关于hibernate - 带有CockroachDB的简单CRUD应用程序中的org.hibernate.TransactionException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49339135/
以下使用Spring Boot,Hibernate,JpaRepository,CockroachDB和Kotlin的最小CRUD示例生成org.springframework.orm.jpa.Jpa
对有点误导性的标题表示歉意。 我有一个 device-id 应用程序,它基本上保存发送到系统的任何新 deviceId 或根据请求返回任何 deviceId 的详细信息. 这个问题不是很常见,但它确实
我是hibernate的初学者。当我试图将对象保存到表不存在的数据库中时。我遇到了一个异常(exception) org.hibernate.TransactionException:在 org.rk
我正在开发一个 Spring/Hibernate/Vaadin 应用程序,尽管进行了大量研究,但我仍然无法解决一个问题。我的应用程序分为四层:模型 存储库 服务 View 当我使用笔记本电脑时,
我将 spring 与 hibernate 和我的 sql 一起使用。我得到这个异常(exception) at org.hibernate.transaction.JDBCTransaction.b
(对 Spring 还是有点陌生) 我需要一个服务方法,它同时是 @Scheduled 和 @Transactional,这样我就可以在其中调用 DAO。 声明式事务已启用,事务管理器是一个基于
感谢您的回复:)我的Web应用程序配置如grails 2.4.4版本,hibernate 4.3.6最终版本以及spring-core-4.0.7.RELEASE。 我表现得像 Session ses
我正在编写我的第一个使用 Hibernate Framework 插入记录的示例。 首先,我尝试按照 URL 给出的说明进行操作 你可以在 GIT Hibernate Basic 查看我的代码 当调用
我们收到错误导致:org.hibernate.TransactionException:JDBC 开始事务失败: 请在下面找到 8820042 WARN o.h.e.jdbc.spi.SqlExce
据我了解,当您尝试在提交前一个事务之前开始一个事务时,会发生此异常。但是,我不明白为什么在我的案例中会出现此异常。 我有一个带有以下 servlet 的网络应用程序: @RestController
我是 Hibernate 的新手。 我尝试编写一个小程序来将数据插入 mysql 数据库服务器。 这是我的程序的源代码: private int insertRelateNew(int newId,
这是我的模型类。这里我们使用 setter 和 getters 方法来初始化变量: package org.koushik.javabrains.dto; import javax.persisten
我正在使用 jersey 和 mysql、hibernate 4 和 c3p0。我创建了一个初始化 servlet,用于配置 hibernate 并将当前 session 上下文类设置为线程。我创建了
运行 removeUserFromConference 方法时出现此异常: 04/06/2012 00:20:48 org.apache.catalina.core.StandardWrapperVa
我已经使用这些技术 + c3p0 构建了一个 Web 服务来进行数据库处理。大多数时候它工作正常,但由于此错误,我有 3-5%(有时甚至 10%)的访问失败。 我以这种方式使用 Hibernate:
我是一名优秀的程序员,十分优秀!