随笔分类 - Spring Hibernate整合
摘要:启动异常: java.lang.ClassCastException: org.springframework.orm.hibernate4.SessionHolder cannot be cast to org.springframework.orm.hibernate3.SessionHolde
阅读全文
摘要:使用步骤:步骤一、在spring配置文件中引入命名空间步骤二、具有@Transactional 注解的bean自动配置为声明式事务支持 步骤三、在接口或类的声明处 ,写一个@Transactional.要是只在接口上写, 接口的实现类就会继承...
阅读全文
摘要:http://www.blogjava.net/Todd/archive/2010/04/22/295112.html方法一:在初始化时保存ApplicationContext对象代码:ApplicationContext ac = new FileSystemXmlApplicationConte...
阅读全文
摘要:1:get/load存取单条数据publicTeachergetTeacherById(Longid){return(Teacher)this.hibernateTemplate.get(Teacher.class,id);}publicTeachergetTeacherById(Longid){r...
阅读全文
摘要:hibernateTemplate的常用方法:Øvoid delete(Object entity):删除指定持久化实例ØdeleteAll(Collection entities):删除集合内全部持久化类实例Øfind(String queryString):根据HQL查询字符串来返回实例集合Øf...
阅读全文
摘要:HibernateTemplate类属于spring框架中的类 :org.springframework.orm.hibernate3.HibernateTemplateHibernateTemplate类目前Hibernate4不支持此类,只支持到Hibernate3,而且在SH整合过程中,如果D...
阅读全文
摘要:1 applicationContext.xml配置文档 --> org.hibernate.dialect.MySQL5InnoDBDialect true ...
阅读全文