11 2009 档案
摘要:首先要导入基于Spring 的Jar 包!//定义要发关Mail 的接口public interface MailService { /** * 发送注册成功的邮件 * @param account */ void sendRegisteMail(Account account); /** * 发送下订单成功的邮件 * @param order */ void sendOrderMail(Order order); /** * 群发广告邮件 * @param accounts 账号列表 * @param subject 主题 * @param content 内容 */ void sentA.
阅读全文
摘要:注:所需的包 commonds-collection-*.jar commonds-logging-*.jar quartz-*.jar spring.jar不需要spring 集成的quartz 示例链接:http://thorlst.blog.163.com/blog/static/59275749200862413854176/
阅读全文
摘要:使用annotcontion编写配置文件:contextConfigLocationclasspath:applicationContext-*.xml/WEB-INF/applicationContext-*.xml --> org.springframework.web.context.ContextLoaderListenercharsetFilterorg.springframework.web.filter.CharacterEncodingFilterencodingUTF-8charsetFilter/*osivorg.springframework.orm.hiberna
阅读全文
摘要:public interface GenericDao {void create(T entity);void delete(T entity);void update(T entity);T findById(Serializable oid);List findAll();PageModel findByPager(int pageNo, int pageSize);}public class GenericDaoImpl implements GenericDao {private Class entityClass;private String entityName;@Suppress
阅读全文
摘要:在hibernate.cfg.xml中加入以下代码org.hibernate.transaction.JDBCTransactionFactory 2在每个实体类中加入一个private int version;的属性并提供getters 和 putters 方法!同时在此类中映射文件中 后加入就可以了!
阅读全文
摘要:在Hibernate 中存在着两个Cache !1:Session 级缓存,叫做hibernate的一级缓存,不可以人为删除!程序员只能控制!缓存了当前事务操作过的一些对象。2:SessionFactory 级缓存!通常叫做二级缓存!在程序起动的时候二级缓存会存入一些通过xxx.hnm.xml映射的元数据和静态的SQL语句!Hibernate 没有提供具体的实现!而是交给了其他的组件!下面我们来配置一下!1> 把encache.xxx.jar 和它的配置文件ehcache.xml 拷到类路径下!2>在hibernate.cfg.xml文件中填入:org.hibernate.cach
阅读全文