Since Hibernate integrates JDBC, the code used by Hibernate to connect to and access the database is much less than that used to access the database directly. However, the Code for accessing the Hibernate configuration file, SessionFactory, and Session must be added accordingly. In order to solve the reuse problem of the same code above, Hibernate again encapsulated it, so we were lucky to see HibernateDaoSupport. Therefore, it is easier to use the HibernateDaoSupport template for database access, especially for simple addition, deletion, modification, and query. The following is my own code reference:/*** @ author wifygoo * simple addition, deletion, modification, and query of enterprise information. */Public class EnterpriseDaoImpl extends HibernateDaoSupport implements EnterpriseDao {/*** @ param Enterprise * deletes an Enterprise information. */Public void del (Enterprise enterprise) {this. getHibernateTemplate (). delete (enterprise) ;}/ *** @ return all Enterprise information. * Query all enterprise information. * // @ SuppressWarnings ("unchecked") public List <Enterprise> findallpolicises () {String hql = "from Enterprise enterprise"; return this. getHibernateTemplate (). find (hql);}/*** @ param Integer, enterprise ID. * @ Return refers to the information of an enterprise. * Query enterprise information by enterprise ID. */Public Enterprise findEnterpriseById (Integer id) {return (Enterprise) this. getHibernateTemplate (). load (Enterprise. class, id);}/*** @ param Enterprise * to add Enterprise information. */Public void save (Enterprise enterprise) {this. getHibernateTemplate (). save (enterprise);}/*** @ param Enterprise * modify Enterprise information. */Public void update (Enterprise enterprise) {this. getHibernateTemplate (). update (enterprise );}}