observer="observe_time";
Cnd cnd = Cnd.NEW();
cnd.and("station_id", "=", station.getStation_id());
cnd.and(observer, ">=",datestart);
cnd.and(observer, "<=", dateend);
cnd.and(stationType.getArrival_report_status(), "!=", "1");
cnd.getOrderBy().desc(observer);
其中observer在数据库中是timestamp类型,dateend和datestart是datetime格式的string,我已将dateend和datestart转换成timestamp类型,可是一直报错:
CaseMessage=ERROR: operator does not exist: smallint = character varying
建议:No operator matches the given name and argument type(s). You might need to add explicit type casts.
如何解决
6 回复
mysql数据库?
cnd.and(stationType.getArrival_report_status(), "!=", "1");
这句是什么东西, getArrival_report_status返回的是属性名??? 写反了?
其他的sql没问题主要问题在这里
cnd.and(observer, ">=",datestart);
cnd.and(observer, "<=", dateend);
observer是timestamp类型(PostgreSQL数据库),datestart(String 类型)和dateend(String 类型)转换为timestamp类型了,报错
CaseMessage=ERROR: operator does not exist: smallint = character varying
建议:No operator matches the given name and argument type(s). You might need to add explicit type casts.
把cnd.and(stationType.getArrival_report_status(), "!=", "1");注释掉试试
来自炫酷的 NutzCN
添加回复
请先登陆