代码改变世界

随笔档案-2012年5月23日

Hibernate工作原理(1)

2012-05-23 17:40 by myjava2, 167 阅读, 收藏,
摘要: 这两天再看hibernate,就自己总结了hibernate对jdbc的封装过程。1.通过Configuration().configure();读取并解析hibernate.cfg.xml配置文件2.由hibernate.cfg.xml中的<mapping resource="com/xx/User.hbm.xml"/>读取并解析映射信息3.通过config.buildSessionFactory();//创建SessionFactory4.sessionFactory.openSession();//打开Sesssion5.session.beginTran 阅读全文

Struts2 自定义拦截器(方法拦截器)

2012-05-23 11:26 by myjava2, 366 阅读, 收藏,
摘要: 转自:http://05061107cm.iteye.com/blog/365504struts2系统自带了很多拦截器,有时需要我们自己定义,一般有两种方式:一、实现Interceptor接口Java代码publicinterfaceInterceptorextendsSerializable{publicvoidinit();publicvoiddestroy();publicStringintercept(ActionInvocationinvocation)();}实现上述方法二、继承AbstractInterceptor类,重写intercept()方法即可 此方法更可行,其实Abst 阅读全文