Hibernate inserts invalid data after handing over spring things to be managed, does not send sql statements, does not report errors, but can query the data.

  mysql, question

Hibernate inserts invalid data after handing over spring transaction to be managed. It does not send sql statements or report errors, but it can query the data.
Getcurrentsession (). flush () can be written to the database immediately if sessionfactory.getcurrentsession () is executed manually.
Automatic transaction cannot submit it unless it is done manually.
It is suspected that spring transaction management is not working.
(The student party has just learned the framework. Please indicate any inappropriate points.)

Dao layer code:

public class UserDao implements IUserDao{
 private SessionFactory sessionFactory;
 public SessionFactory getSessionFactory() {
 return sessionFactory;
 bracket
 public void setSessionFactory(SessionFactory sessionFactory) {
 this.sessionFactory = sessionFactory;
 bracket
 public boolean addUser(User user) {
 Get log (). info ("user insert operation in progress ~");
 try {
 sessionFactory.getCurrentSession().save(user);
 } catch (Exception e) {
 LogUtil.getLog().error(e);
 return false;
 bracket
 return true;
 bracket

Controller layer:

if(code.equals(checkCode)){
 if(userDao.addUser(user)){
 //Add User Information to session
 return "redirect:/returnIndex";
 }else{
 Model.addAttribute("message ","system exception, registration failed! "  );
 return "forward:/user/returnRegiste";
 bracket
 }else{
 Add attribute ("message", "verification code error!"  );
 return "forward:/user/returnRegiste";
 bracket

Xml configuration:

<!-- c3p0数据源 -->
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
       destroy-method="close">
        <property name="user"><value>root</value></property>
        <property name="password"><value></value></property>
        <property name="minPoolSize"><value>20</value></property>
        <property name="maxPoolSize"><value>100</value></property>
        <property name="initialPoolSize"><value>20</value></property>
        <property name="driverClass"><value>com.mysql.jdbc.Driver</value></property>
        <property name="jdbcUrl"><value>jdbc:mysql://localhost:3306/db_shop?useUnicode=true&amp;characterEncoding=UTF-8</value></property>
    </bean>
    <!-- session工厂 -->
    <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <property name="annotatedClasses">
            <list>
                <value>edu.hnuc.entity.User</value>
            </list>
        </property>
        <property name="dataSource" ref="dataSource"></property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.hbm2ddl.auto">update</prop>
                <prop key="hibernate.dialect">edu.hnuc.util.UTF8CharacterDialect</prop>
                <prop key="hibernate.show_sql">true</prop>
            </props>
        </property>
    </bean>
    <!-- 事务管理器 -->
    <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory"></property>
    </bean>
    <!-- 通知 -->
    <tx:advice id="myAdvice" transaction-manager="transactionManager">
        <tx:attributes>
            <tx:method name="get*" read-only="true"/>
            <tx:method name="*" />
        </tx:attributes>
    </tx:advice>
    <!-- 切入点 -->
   <aop:config>
           <aop:pointcut expression="execution(* edu.hnuc.dao.impl.*.*(**))" id="myPoincut"/>
           <aop:advisor advice-ref="myAdvice" pointcut-ref="myPoincut"/>
   </aop:config>
   <!-- openSessionInView -->
   <mvc:interceptors>
        <bean class="org.springframework.orm.hibernate4.support.OpenSessionInViewInterceptor">
                <property name="sessionFactory" ref="sessionFactory"></property>
        </bean>
   </mvc:interceptors>

File structure:
clipboard.png

There is no configuration transaction in your configuration file, how to submit it automatically? You must have to manually commit the transaction in the code yourself.
The simplest is this

<tx:annotation-driven transaction-manager="transactionManager" />
 <bean id="transactionManager"
 class="org.springframework.orm.hibernate3.HibernateTransactionManager">
 <property name="sessionFactory" ref="sessionFactory" />
 </bean>

Then add @Transactional to your dao method
Update the answers in the comments

Write this way

<aop:pointcut expression="execution(* edu.hnuc.dao.impl.*.*(..))" id="myPoincut"/>