Commit be706b9e authored by yajun.zhang's avatar yajun.zhang

优化

parent d5f7c354
...@@ -31,10 +31,11 @@ public class DatabaseConnectionKeeper { ...@@ -31,10 +31,11 @@ public class DatabaseConnectionKeeper {
public void keepDatabaseConnectionAlive() { public void keepDatabaseConnectionAlive() {
log.info("数据库定时任务执行"); log.info("数据库定时任务执行");
try { try {
// 执行一个简单的查询操作
Query countQuery = entityManager.createNativeQuery("SELECT 1"); Query countQuery = entityManager.createNativeQuery("SELECT 1");
Object count = countQuery.getSingleResult(); Object count = countQuery.getSingleResult();
log.info("查询结果:{}",count); log.info("查询结果:{}",count);
// jdbcTemplate.execute("SELECT 1"); // 执行一个简单的查询操作 // jdbcTemplate.execute("SELECT 1");
} catch (Exception ex) { } catch (Exception ex) {
// 处理异常 // 处理异常
log.error("数据库定时任务执行异常",ex); log.error("数据库定时任务执行异常",ex);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment