主数据库hefei_energy_consumption_monitor
副数据库hefei_energy
两张表都存在tb_alarm_record
使用db.update在服务器上报错
com.jfinal.plugin.activerecord.ActiveRecordException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'hefei_energy_consumption_monitor.hefei_energytb_alarm_record' doesn't exist at com.jfinal.plugin.activerecord.DbPro.update(DbPro.java:313) at com.jfinal.plugin.activerecord.DbPro.update(DbPro.java:324) at com.jfinal.plugin.activerecord.Db.update(Db.java:260) at com.hhubrain.energy.model.AlarmRecord.updateAlarmRecordOnlyDurationMin(AlarmRecord.java:233) at com.hhubrain.energy.service.SwitchAlarmService$4.run(SwitchAlarmService.java:483) at com.jfinal.plugin.activerecord.DbPro.tx(DbPro.java:770) at com.jfinal.plugin.activerecord.DbPro.tx(DbPro.java:807) at com.jfinal.plugin.activerecord.Db.tx(Db.java:533) at com.hhubrain.energy.service.SwitchAlarmService.terminateAlarmRecord(SwitchAlarmService.java:479) at com.hhubrain.energy.service.SwitchAlarmService.switchAlarmUpgrade(SwitchAlarmService.java:419) at com.hhubrain.energy.service.SwitchAlarmService.switchAlarmMonitor(SwitchAlarmService.java:172) at com.hhubrain.energy.job.EveryFiveMinJob.alarmJob(EveryFiveMinJob.java:69) at com.hhubrain.energy.job.EveryFiveMinJob.run(EveryFiveMinJob.java:28) at it.sauronsoftware.cron4j.RunnableTask.execute(Unknown Source) at it.sauronsoftware.cron4j.TaskExecutor$Runner.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
使用dao.findById和打印sql都是正常的 {alarm_name:一级开关全局报警定义, eid:92BF64352A0501C9E055000000000001, peid:196, level:1, alarm_time:2020-05-28 19:50:00.0, is_global:1, process_user:null, ptype:1, type:1, f_type:0, duration_min:0, update_time:2020-05-28 19:50:00.0, alarm_type:1, alarm_content:手动喷漆线1#运行,手动喷漆线1# 废水+废气处理未运行, id:15056, did:1, status:1, cid:196} UPDATE tb_alarm_record SET duration_min = '340',update_time='2020-05-29 01:30:00',status='3' WHERE id = '15056'
但是使用update就会报上面的错
Table 'hefei_energy_consumption_monitor.hefei_energytb_alarm_record' doesn't exist
tablename前会加上副数据库名
项目:JFinal
建议单步调试跟踪一下,看是哪个环境出现的问题