2020-09-17 15:20
@doubuxingle 用“?”就没意思了,顺序和类型都要对上,越写越多零散要封装。我是在写通用方法,所以用SQL管理,然后调用通用方法执行查询。
2020-09-17 13:51
@doubuxingle 我知道还有paginateByFullSql 这些方法,但这些用的都是字符sql,而我是用SQL管理的,需要用sqlPara,如果要通过sqlPara获取出来的sql,#para() 这样的设值方式就没用了。
2019-10-15 09:27
我更新到4.5,也出现类似问题,报错如下
[ERROR]-[Thread: XNIO-1 task-1]-[com.jfinal.proxy.ProxyCompiler.lambda$outputCompileError$0()]: /IndexService$$EnhancerByJFinal.java:3: 错误: 程序包com.jfinal.aop不存在
import com.jfinal.aop.Invocation;
2019-10-15 09:22:12
[ERROR]-[Thread: XNIO-1 task-1]-[com.jfinal.proxy.ProxyCompiler.lambda$outputCompileError$0()]: /IndexService$$EnhancerByJFinal.java:7: 错误: 找不到符号
Invocation inv = new Invocation(this, 1L,
^
2019-10-15 09:22:12
[ERROR]-[Thread: XNIO-1 task-1]-[com.jfinal.core.ActionHandler.handle()]: com.scbc.controller.IndexController.index() : /
java.lang.RuntimeException: java.lang.ClassNotFoundException: com.scbc.service.IndexService$$EnhancerByJFinal
at com.jfinal.proxy.ProxyClassLoader.loadProxyClass(ProxyClassLoader.java:51)
at com.jfinal.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:70)
at com.jfinal.proxy.ProxyFactory.get(ProxyFactory.java:41)
at com.jfinal.proxy.Proxy.get(Proxy.java:32)
at com.jfinal.aop.AopFactory.createObject(AopFactory.java:173)
at com.jfinal.aop.AopFactory.doGetSingleton(AopFactory.java:87)
at com.jfinal.aop.AopFactory.doGet(AopFactory.java:65)
at com.jfinal.aop.AopFactory.doInject(AopFactory.java:157)
at com.jfinal.aop.AopFactory.inject(AopFactory.java:125)
at com.jfinal.aop.Aop.inject(Aop.java:105)
at com.jfinal.core.ActionHandler.handle(ActionHandler.java:77)
at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:89)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.SessionRestoringHandler.handleRequest(SessionRestoringHandler.java:119)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:364)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.ClassNotFoundException: com.scbc.service.IndexService$$EnhancerByJFinal
at java.lang.ClassLoader.findClass(ClassLoader.java:530)
at com.jfinal.proxy.ProxyClassLoader.findClass(ProxyClassLoader.java:64)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.jfinal.proxy.ProxyClassLoader.loadProxyClass(ProxyClassLoader.java:49)
2018-09-05 15:14
@JFinal 已摸索到解决了
com.jfinal.plugin.activerecord.DbKit.getConfig().getSqlKit().setBaseSqlTemplatePath(com.jfinal.kit.PathKit.getRootClassPath()); //设置根目录
com.jfinal.plugin.activerecord.DbKit.getConfig().getSqlKit().addSqlTemplate("/com/landray/kmss/odm/sql/all.sql"); //加载sql文件
com.jfinal.plugin.activerecord.DbKit.getConfig().getSqlKit().parseSqlTemplate(); //让加载的文件生效
2018-09-05 14:42
@JFinal 挺急的,在线等!我目的是想动态加载template,或者有没有全局template,可以让已启动的activeRecordPlug用到
2018-09-05 13:53
@JFinal 谢谢老师回复,我想再了解下,因为我是独立在项目中用ActiveRecord的嘛,项目已启动了,这个插件也已启动连接数据源了,还能不能追加sql脚本,如
DbKit.getConfig().getSqlKit().setBaseSqlTemplatePath(PathKit.getRootClassPath());
DbKit.getConfig().getSqlKit().addSqlTemplate("/com/sql/all.sql");
我调用了这两句来对默认的数据源追加sql映射,但还没生效,引用不了,有没办法让它生效呢
2018-09-05 10:41
@JFinal 有没方法切换默认的数据源,如我定义了两个数据源,不调用usr("")的时候直接Db.find用的就是默认的数据源,我想把默认数据源切换成另一个,然后在任何默认用的都是这个数据源,有没这个操作呢?