不知道为什么,没有错误提示,hibernatetemplate.save(stu)就是不能保存实体,我的配置文件如下:
application.xml:
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configurationClass"><value>org.hibernate.cfg.AnnotationConfiguration</value></property>
<property name="configLocation"><value>classpath:hibernate.cfg.xml</value></property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="stuDao" class="StudentDaoImpl">

<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="stuService" class="StudentService">
   <property name="stuDao" ref="stuDao"></property>
</bean>
<bean id="transactionProxy"     class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="transactionManager"></property>
   </property>
<property name="target" >
<ref local="stuService"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED </prop>
</props>
</property>
</bean>
</beans>
hibernate.cfg.xml:
<property name="hibernate.connection.provider_class">
org.hibernate.connection.ProxoolConnectionProvider
</property> <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.show_sql">true</property>

<property name="hibernate.proxool.xml">proxool.xml</property>
<property name="hibernate.proxool.pool_alias">DBPool</property>
<property name="hiberante.defaultAutoCommit">true</property>StudentDaoImpl.java:
    
public class StudentDaoImpl extends HibernateDaoSupport implements StudentDao{
public void saveStudent(Student stu) {

this.getHibernateTemplate().save(stu);
    }
}StudentService.java:
public class StudentService {
    private StudentDao stuDao;
public void saveStudent(Student stu){
     stuDao.saveStudent(stu);
    }
}
测试语句:
ApplicationContext ac=new FileSystemXmlApplicationContext("src/applicationContext.xml");
Student stu=new Student();
stu.setId(13);
stu.setName("aaa");
StudentService stuService=(StudentService)ac.getBean("stuService");
stuService.saveStudent(stu);运行结果:
Hibernate: insert into student (name, id) values (?, ?)
可数据库中就是没有记录。哪位知道原因啊,在线等待