Postgres Ratpack 关系不存在
Postgres Ratpack relation does not exist
我正在使用 Ratpack 和 Postgres 创建一个简单的应用程序,目前我只是将数据添加到我的 Postgres 数据库中。
数据被映射到我的 groovy 对象,然后很好地插入到数据库中,但是在我的日志中我遇到了这个错误。
ratpack-blocking-34-1] WARN com.zaxxer.hikari.pool.HikariPool - 保持活动检查期间出现异常,这意味着连接 (org.postgresql.jdbc4.Jdbc4Connection@1b89ab21) 必须是死的。
org.postgresql.util.PSQLException: 错误:关系 "hospital" 不存在
它按预期工作,但我不确定我做错了什么导致出现此错误。
这是我将数据添加到数据库中的代码。
@Override
Operation save(Hospital hospital) {
Blocking.get {
sql.execute "INSERT INTO hospitals (id,name) VALUES (${hospital.id}, ${hospital.name})"
}.operation()
}
然后这是我的处理程序
void handle(Context ctx, HospitalService hospitalService) {
ctx.byMethod { method ->
method.post {
ctx.parse(Form). then { form ->
def name = form.name
if (name) {
def id = UUID.randomUUID()
def hospital = new Hospital(id: id, name: name)
hospitalService.save(hospital).onError { error ->
ctx.render json([success: false, error: error.message])
} then {
ctx.render handlebarsTemplate("added-new.html")
}
} else {
ctx.response.status(400)
ctx.render(json([success: false, error: "name is required"]))
}
}
}
谁能看出我为什么会收到这条消息?尽管它似乎按预期工作。
按照此处的说明进行操作
HikariCP with PostgreSQL: setQueryTimeout(int) is not yet implemented
我的 connectionTestQuery 在构造函数中没有引用数据库中正确的 table 是一个问题。
我正在使用 Ratpack 和 Postgres 创建一个简单的应用程序,目前我只是将数据添加到我的 Postgres 数据库中。
数据被映射到我的 groovy 对象,然后很好地插入到数据库中,但是在我的日志中我遇到了这个错误。
ratpack-blocking-34-1] WARN com.zaxxer.hikari.pool.HikariPool - 保持活动检查期间出现异常,这意味着连接 (org.postgresql.jdbc4.Jdbc4Connection@1b89ab21) 必须是死的。 org.postgresql.util.PSQLException: 错误:关系 "hospital" 不存在
它按预期工作,但我不确定我做错了什么导致出现此错误。
这是我将数据添加到数据库中的代码。
@Override
Operation save(Hospital hospital) {
Blocking.get {
sql.execute "INSERT INTO hospitals (id,name) VALUES (${hospital.id}, ${hospital.name})"
}.operation()
}
然后这是我的处理程序
void handle(Context ctx, HospitalService hospitalService) {
ctx.byMethod { method ->
method.post {
ctx.parse(Form). then { form ->
def name = form.name
if (name) {
def id = UUID.randomUUID()
def hospital = new Hospital(id: id, name: name)
hospitalService.save(hospital).onError { error ->
ctx.render json([success: false, error: error.message])
} then {
ctx.render handlebarsTemplate("added-new.html")
}
} else {
ctx.response.status(400)
ctx.render(json([success: false, error: "name is required"]))
}
}
}
谁能看出我为什么会收到这条消息?尽管它似乎按预期工作。
按照此处的说明进行操作
HikariCP with PostgreSQL: setQueryTimeout(int) is not yet implemented
我的 connectionTestQuery 在构造函数中没有引用数据库中正确的 table 是一个问题。