AutoTableBindPlugin atbp = new AutoTableBindPlugin(druidPlugin,SimpleNameStyles.LOWER);
me.add(atbp);
----我已经加了这个。。但还是报错:
[ERROR]-[Thread: qtp111632506-19]-[com.jfinal.core.ActionHandler.handle()]: /admin/producttype/add
java.lang.RuntimeException: The TableMapping of model: com.ztshop.model.ProductType not exists. Please add mapping to ActiveRecordPlugin(activeRecordPlugin.addMapping(tableName, YourModel.class)).
at com.jfinal.plugin.activerecord.TableInfoMapping.getTableInfo(TableInfoMapping.java:42)
arp.addMapping("producttype", ProductType.class);
----加上这个就可以
启动有debug日志。
log.debug("addMapping("。。
你看有没有绑定的日志。
有几种情况可能绑定不了。
目前有的容器不支持,据说weblogic不行。
自动绑定其实就是扫描classpath。
如果你的model在jar包中需要显式的用addJar方法加上你要扫描的jar。
用AutoTableBindPlugin 就不要加ActiveRecordPlugin,因为前者是后者子类
如果都不行可以调试一下代码把,有可能是某些情况扫描出问题了
List<Class<?extendsModel>>modelClasses=ClassSearcher.findInClasspathAndJars(Model.class,includeJars);
97行
publicclassProductTypeextendsModel<ProductType>{
}
我有绑定的
@jfinal DruidPlugindruidPlugin=newDruidPlugin("jdbc:mysql://127.0.0.1/ztshop","root","root");me.add(newEhCachePlugin());
------我这样写有问题吗?
时时分享云计算技术内容,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。