在applicationContext.xml中配置如下
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean>
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory"></property></bean>
在dao实现中调用 this.hibernateTemplate.save(entity);控制台打印如下信息
Hibernate: select sshproduct0_.id as id2_0_, sshproduct0_.category_id as category2_2_0_, sshproduct0_.name as name2_0_, sshproduct0_.price as price2_0_, sshproduct0_.mounts as mounts2_0_, sshproduct0_.sellMounts as sellMounts2_0_ from hibernate.ssh_product sshproduct0_ where sshproduct