2017-04-27 19:40

记得导 jar 和配置 ehcache.xml

再死记一条:
与web环境唯一的不同是要手动调用一次相关插件的start()方法

调用插件的start()!调用插件的start()!调用插件的start()!2333333

2017-04-27 19:37

PropKit.use("a_little_config.txt");
DruidPlugin dp = new DruidPlugin(PropKit.get("jdbcUrl"), PropKit.get("user"), PropKit.get("password").trim());
ActiveRecordPlugin arp = new ActiveRecordPlugin("oracle", dp);
arp.addMapping("blog", Blog.class);
arp.setCache(new EhCache());
EhCachePlugin ecp = new EhCachePlugin();
// 与web环境唯一的不同是要手动调用一次相关插件的start()方法
ecp.start();
dp.start();
arp.start();
// 通过上面简单的几行代码,即可立即开始使用
new Blog().set("title", "title1").set("content", "cxt text").save();
new Blog().set("title", "title2").set("content", "cxt text").save();

//--------------------------------------------------------------------
// ----- 使用缓存
Blog blog = Blog.me.findFirstByCache("sampleCache2", "1", "select * from blog where id=?", 1);

2017-04-25 19:58

还有可以加拦截器, 根据你的规则,自己切就好了

2017-04-25 19:52

在"/"controller中的index方法中, 加个判断, if(已登录) 去首页, else 去登录页

2017-04-25 19:46

如果是拷贝model属性的话: model_1._setAttrs(model_2)

2017-04-25 13:40

小棉袄~很贴心~先点赞收藏

2017-04-19 09:34

加入俱乐部然后看源码咯! 非常的干净易读易懂

2017-04-19 09:16

#include

2017-04-15 14:47

还可以这样啊 :
public void testIAtom(){
final Ret ret = Ret.create("什么码?", "我不知道啊");
boolean tx = Db.tx(new IAtom(){
@Override
public boolean run() throws SQLException {
//操作1
ret.put("什么码?", "错误1");
//操作2
ret.put("什么码?", "错误2");
//操作3
ret.put("什么码?", "错误3");
//操作4
ret.put("什么码?", "错误4");
try {
//操作5

} catch (Exception e) {
ret.put("什么码?", "错误5");
return false;
}
return true;
}});
ret.put("成功没有?", tx);
renderJson(ret.getData());
System.out.println(tx);
System.out.println(ret.toString());
}

2017-04-15 14:26

用拦截器啊 ActiveRecord 支持声名式事务 手册5.5章处

2017-04-10 22:00

https://www.oschina.net/p/poi

2017-04-10 21:42

jfinal-3.0-manual.pdf 第四章 AOP
4.3 Before
// 配置一个Class级别的拦截器,她将拦截本类中的所有方法
// 配置多个Method级别的拦截器,仅拦截本方法

2017-03-29 22:11

@EATI001 在你的model 中加个 public Boolean save( Model model ) { return model.save() } 这样写...才不优雅了,,, 肯定不如 直接写 model.save() 好啊,,, 符合人性视觉.... 23333

2017-03-28 09:35

@ghostsf 这只是提供一种管理方式

serverName 多对一 configName:---------
ActiveRecordPluginService中是让多域名对应一个数据源的,
如: static map//初始化值

我这边业务场景: 客户会经常换域名, 而且我们这边也提供二,三,级域名, 有的客户自己绑定一级域名, 所以在中间加了个K, 域,名任你随便换我只保证系统这边K唯一就搞定了.

serverName 一对多 configName:---------
一个serverName对多个数据源, 需要根据你业务组装不同的规则就好了, 比如说: 系统的日志数据源吧, 完全可以是 serverName_log 这种形式当K.
还可以是url挂参configName的形式, 还可以是 缓存中 取不同configName. 比如上面ActiveRecordPluginService中static map中值再放configName集合,这也是一种组装方式, 需要看业务场景

serverName 一对一 configName:---------
直接用DbKit就好了

jfinal数据源非常灵活,根据自己需求去组装不同规则就好了