These days are empty, just learn Spring and Hibernate (introduced in the English reference in Spring). The following mainly introduces the change after Hibernate 1. Use Hibernate to add sessionFactory in the configuration file. Configuration, as follows
. 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; copany 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;}}