从网上找的hibernate源码
package org.springframework.orm.hibernate3.support; import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.dao.DataAccessException; import org.springframework.dao.DataAccessResourceFailureException; import org.springframework.dao.support.DaoSupport; import org.springframework.orm.hibernate3.HibernateTemplate; import org.springframework.orm.hibernate3.SessionFactoryUtils; public abstract class HibernateDaoSupport extends DaoSupport { private HibernateTemplate hibernateTemplate; public final void setSessionFactory(SessionFactory sessionFactory) { this.hibernateTemplate = createHibernateTemplate(sessionFactory); } protected HibernateTemplate createHibernateTemplate(SessionFactory sessionFactory) { return new HibernateTemplate(sessionFactory); } public final SessionFactory getSessionFactory() { return (this.hibernateTemplate != null ? this.hibernateTemplate.getSessionFactory() : null); } public final void setHibernateTemplate(HibernateTemplate hibernateTemplate) { this.hibernateTemplate = hibernateTemplate; } public final HibernateTemplate getHibernateTemplate() { return this.hibernateTemplate; } protected final void checkDaoConfig() { if (this.hibernateTemplate == null) { throw new IllegalArgumentException("'sessionFactory' or 'hibernateTemplate' is required"); } } protected final Session getSession() throws DataAccessResourceFailureException, IllegalStateException { return getSession(this.hibernateTemplate.isAllowCreate()); } protected final Session getSession(boolean allowCreate) throws DataAccessResourceFailureException, IllegalStateException { return (!allowCreate ? SessionFactoryUtils.getSession(getSessionFactory(), false) : SessionFactoryUtils.getSession( getSessionFactory(), this.hibernateTemplate.getEntityInterceptor(), this.hibernateTemplate.getJdbcExceptionTranslator())); } protected final DataAccessException convertHibernateAccessException(HibernateException ex) { return this.hibernateTemplate.convertHibernateAccessException(ex); } protected final void releaseSession(Session session) { SessionFactoryUtils.releaseSession(session, getSessionFactory()); } }
相关推荐
springboot2.0多数据源集成hibernate配置hibernateDaoSupport, dao层继承hibernateDaoSupport, 不使用jpa方式。
Spring hibernate3. HibernateDaoSupport 源码
HibernateDaoSupport分页.txt
HibernateDaoSupport 类的jar HibernateDao 的jar
spring-boot 集成hibernate,使用druid数据库连接池,dao继承HibernateDaoSupport 的实现,
HibernateDaoSupport详解 HibernateDaoSupport详解
NULL 博文链接:https://godit.iteye.com/blog/1716651
6.Hibernate继承 HibernateDaoSupport。 7.Spring+Junit4单元测试,优点:不会破坏数据库现场,等等。 2)Demo 导入说明: 1.Eclipse Encoding:GBK 2.Eclipse 导入后可能需要在 Xml Catalog 手动添加:ehcache-...
HibernateDaoSupport的使用
hibernateDaoSupport类的详解!
springboot集成hibernate无jpa,在dao中使用SessionFactory操作数据库
java基于SSH框架的学生成绩管理系统源码。要求: (1) 整合Struts2、Spring和Hibernate框架 (2) 实现“登录”功能 (3) 实现“学生信息管理”功能 (4) 实现“学生成绩管理”功能 (5) 实现分页功能 目的...
NULL 博文链接:https://yizhilong28.iteye.com/blog/818989
本篇文章主要介绍了Spring4整合Hibernate5详细步骤,具有一定的参考价值,有兴趣的同学可以了解一下
SSH整合(其中dao用extends HibernateDaoSupport方式)总结【图解】
.相同点:在applicationConext.xml中 ... HibernateDaoSupport: 在impl中要调用的方法要getHibernateTemplate().delete(user); UserDaoHiberateImpl: 在impl中要调用的方法要hibernateTemplate.save(user);
HibernateCallback是一个接口,位于org.springframework.orm.hibernate3中。 该接口中只有一个方法doInHibernate(Session session)。 通常,程序中采用实现HibernateCallback的匿名内部类来获取HibernateCallback的...
其中包含有org.springframework.orm.hibernate3.support.HibernateDaoSupport.class,
两种配置文件: A.hibernate.cfg.xml 和 B.hibernate.properties A中可含映射文件的配置,而B中hard codes加映射文件。 A。Configuration config=new Configuration().config(); B. ...
SpringSide对Hibernate做了三层封装: 第一层:HibernateGenericDao,基于spring的HibernateDaoSupport,但加入了分页函数与各种Finder函数,并使用泛型避免了返回值强制类型转换。 第二层:HibernateEntityDao,...