我的申请遇到了一个奇怪的问题,我在其中一个查询中收到了这个错误:
SEVERE:java.sql.SQLException:错误:缓存计划不得更改结果类型。
我只在生产环境中收到此错误。
我找不到任何错误或不同的东西,除了在开发者环境中我使用maven jetty:运行启动应用程序(Maven 3.3.9),并且在生产中我有一个Apache Tomcat v.8.0.30。我的开发环境中的Java版本在生产中更新1.8.0_73
vs 1.8.0_71-b15
,这就是全部。
有一会儿我认为这是我的数据库,但问题应该出现在生产和开发人员身上,但是没有发生只有生产受到影响。
我的数据库在PostgreSQL 9.4.9上。
提前谢谢。
********编辑*******
我检查了这个链接:Postgres 8.3: "ERROR: cached plan must not change result type"但我没有更改我的表或其列的脚本。
*****编辑2 *****
我添加了代码:
static public ArrayList<OKCalendarEvent> listAllEventsByCalendarAndStatusBetween(String idCalendar,
Timestamp from,
Timestamp to,
OKCalendarEventStatus status ,
WDataSource ds) throws OklexDataException {
ArrayList<OKCalendarEvent> events = new ArrayList<>();
String sql = "SELECT " +
" e.idreg ," +
" e.calendar_id ," +
" e.event_processid, " +
" e.event_fieldid, " +
" e.event_code," +
" e.event_name ," +
" e.event_description ," +
" e.user_id ," +
" e.event_start ," +
" e.event_end ," +
" e.event_duration ," +
" e.event_status ," +
" e.event_type ," +
" e.event_buffer ," +
" e.tfc , "+
" e.id_event_origin ," + //20160729
" e.frequencyType ," + //20160729
" e.frequencyEnd ," + //20160729
" e.invitees, " + //20160729
" (u.firstname ||' ' || u.lastname) as fullUserName " + //20160802
"FROM ok_calendar_event e " +
"LEFT JOIN ok_user u " +
"ON e.user_id=u.userid " +
"WHERE e.calendar_id = ? AND e.event_status = ? AND e.event_start BETWEEN ? AND ?;";
try {
List<Object[]> rs = WData.doQuery(ds, sql, idCalendar, status.getEventStatus(), from, to);
for (Object[] obj : rs) {
OKCalendarEvent event = new OKCalendarEvent();
event.setIdreg(NumberUtils.parseToInt(obj[0].toString()));
event.setCalendarId(obj[1].toString());
event.setIdProcess(NumberUtils.parseToLong(obj[2].toString()));
event.setFieldId(obj[3].toString());
event.setCode(obj[4].toString());
event.setName(obj[5].toString());
event.setDescription(obj[6].toString());
event.setUserId(obj[7].toString());
event.setStart(CalendarUtils.stringToTimeStamp(obj[8].toString(), Constants.dateTimeFormat));
event.setEnd(CalendarUtils.stringToTimeStamp(obj[9].toString(), Constants.dateTimeFormat));
event.setDuration(NumberUtils.parseToInt(obj[10].toString(), 0));
event.setStatus(NumberUtils.parseToInt(obj[11].toString(), 0));
event.setType(NumberUtils.parseToInt(obj[12].toString(), 0));
event.setBuffer(obj[13].toString());
event.setTfc(CalendarUtils.stringToTimeStamp(obj[14].toString(), Constants.dateTimeFormat));
//20160729
event.setId_event_origin( NumberUtils.parseToInt(obj[15].toString()) );
event.setFrequency_type( NumberUtils.parseToInt(obj[16].toString()) );
if(obj[17]!=null) {
event.setFrequency_end(CalendarUtils.stringToTimeStamp(obj[17].toString(), Constants.dateTimeFormat));
}
event.setInvitees(obj[18].toString());
event.setUserFullName(obj[19].toString());
events.add(event);
}
} catch (Exception e) {
// process = new ArrayList<Process>();
log.error(" | listAllEventsByCalendarAndStatusBetween | failed, cause: "+ e.toString());
throw new OklexDataException("There was a problem retrieving the OKCalendar list from the database.", e);
}
return events;
}