Spring Hibernate Select BLOG in Carlhui these days to compare empty, just learn Spring and Hibernate (introduced in this regard in Spring in Spring). The following main introduction has used Hibernate to change 1, used Hibernate in the configuration file for an increase sessionFactory configuration, the following
. 3, the original DAO inherited JDBCDaoSupport HibernateDaoSupport longer to increase DAO sessionFactory implantation in the configuration file, the following public class CompanyDAOHibernate extends HibernateDaoSupport implements CompanyDAO {public Company findById (String id) throws HibernateException {Company c = (Company) getHibernateTemplate ( ) .load (Company.class, id); return c;} public Company addCompany (Company company) throws HibernateException {getHibernateTemplate () save (company);. return company;} public void removeCompany (Company company) throws HibernateException {getHibernateTemplate ( ) .delete (company);} public Company updateCompany (Company company) throws HibernateException {getHibernateTemplate () saveOrUpdate (company);. return company;}}
http://blog.9cbs.net/carlhui/