-1
我正在使用Ratpack和Postgres創建一個簡單的應用程序,目前我只是將數據添加到我的Postgres數據庫中。Postgres Ratpack關係不存在
數據被映射到我的groovy對象,然後插入到數據庫中,但是在我的日誌中我遇到了這個錯誤。
ratpack阻斷-34-1] WARN com.zaxxer.hikari.pool.HikariPool - 異常期間永葆檢查,這意味着連接([email protected])一定是死了。 org.postgresql.util.PSQLException:錯誤:關係「醫院」不存在
它按預期工作,但我不知道我在做什麼錯得到這個錯誤。
這是我的代碼,用於將數據添加到我的數據庫中。
@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與PostgreSQL:setQueryTimeout(int)尚未實現](http://stackoverflow.com/questions/26550316/hikaricp-with-postgresql-setquerytimeoutint-is-not-yet-實現) – pocockn