2018-07-02 11:32
主键名默认为小写的 "id",否则需要在映射的时候手动指定一下:
activeRecordPlugin.addMapping(tableName, "ID", modelClass);
如上所示,中间的参数 "ID" 就是大写的 id,具体到你的项目,是一个大写一个小写,改成这样:
activeRecordPlugin.addMapping(tableName, "Id", modelClass);
这种事情早在两年前就不需要手动做了,jfinal 提供了生成器,映射也是自动生成的,会自动解决大小写问题,在首页下载 jfinal demo,里面有生成器的使用例子,直接拿去改下几个参数即可使用
2018-07-02 11:29
@阿帕奇 将 JFinalView 中的下面两行代码:
OutputStream os = response.getOutputStream();
JFinalViewResolver.engine.getTemplate(getUrl()).render(model, os);
外面套上 try catch ,改成:
try {
OutputStream os = response.getOutputStream();
JFinalViewResolver.engine.getTemplate(getUrl()).render(model, os);
} catch (Exception e) { // 捕获 ByteWriter.close() 抛出的 RuntimeException
Throwable cause = e.getCause();
if (cause instanceof IOException) { // ClientAbortException、EofException 直接或间接继承自 IOException
String name = cause.getClass().getSimpleName();
if ("ClientAbortException".equals(name) || "EofException".equals(name)) {
return ;
}
}
throw e;
}
然后使用自己的 JFinalView 代替 jfinal 的 JFinalView 即可
2018-06-29 18:08
@阿帕奇 JFinalView 里头有关 ClientAbortException 这个改动过没有? 难道不改这个就解决了?