SSH框架的getSession().update(entity)不能实现保存

我用的是通用Dao,但是保存方法可以执行,可以保存到数据库,但是更新方法虽然执行了,但是数据却没有更新,这是怎么回事啊,控制台也已经输出了更新语句,就是数据库的数据不更新,代码见下图,求教啊

这是我dao层实现类的代码
package com.ffour.yixing.dao.impl;

import java.io.Serializable;
import java.lang.reflect.ParameterizedType;
import java.util.List;

import javax.annotation.Resource;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

import com.ffour.yixing.dao.interfaces.BaseDao;

@SuppressWarnings("unchecked")

public class BaseDaoImpl implements BaseDao{

private Class<T> clazz;

/** 
 * 通过构造方法指定DAO的具体实现类 
 */  
public BaseDaoImpl() {
    ParameterizedType type = (ParameterizedType) this.getClass().getGenericSuperclass();  
    clazz = (Class<T>) type.getActualTypeArguments()[0];  
    System.out.println("DAO的真实实现类是:" + this.clazz.getName());  
}

/** 
 * 向DAO层注入SessionFactory 
 */  
@Resource  
private SessionFactory sessionFactory; 

/** 
 * 获取当前工作的Session 
 */  
protected Session getSession() {  
    return this.sessionFactory.getCurrentSession();  
}

@Override
public void save(T entity) {
    // TODO Auto-generated method stub
    this.getSession().save(entity);
    this.getSession().flush();
}

@Override
public void update(T entity) {
    // TODO Auto-generated method stub
     this.getSession().update(entity);
     System.out.println("111");
     this.getSession().flush();
}

@Override
public void delete(Serializable id) {
    // TODO Auto-generated method stub
     this.getSession().delete(this.findById(id));
     this.getSession().flush();
}

@Override
public T findById(Serializable id) {
    // TODO Auto-generated method stub
     return (T) this.getSession().get(this.clazz, id);
}

@Override
public List<T> findByHQL(String hql, Object... params) {
    // TODO Auto-generated method stub
    Query query = this.getSession().createQuery(hql);  
    for (int i = 0; params != null && i < params.length; i++) {  
        query.setParameter(i, params[i]);
    }
    return query.list();
}

}

没有配置事务,service层配置注解事务
http://blog.csdn.net/je_ge/article/details/54633287

如果发了sql,数据库不更新,多数都是事务的问题

我的spring配置
<?xml version="1.0" encoding="UTF-8" ?>
xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
default-autowire="byName"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

<!-- 上下文注释配置 -->
<context:annotation-config />
<context:component-scan base-package="com.ffour.yixing.entity" />  
<!-- 引入项目配置属性文件 -->  
<context:property-placeholder location="classpath:db.properties" /> 
<!-- 配置数据源 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <!-- 数据库驱动类 -->
    <property name="driverClassName" value="${database.driverClassName}" />
    <property name="url" value="${database.url}" />
    <property name="username" value="${database.username}" />
    <property name="password" value="${database.password}" />
</bean>

<!-- 会话工厂 -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="configLocation" value="classpath:hibernate.cfg.xml" />
</bean>


<!-- 上下文组件扫描 -->
<context:component-scan base-package="com.ffour.yixing"></context:component-scan>
<!-- 定义事务管理器 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
    <property name="dataSource" ref="dataSource"/>
    <property name="sessionFactory" ref="sessionFactory"></property>
</bean>

<tx:advice id="txAdvice" transaction-manager="transactionManager">  
   <tx:attributes>
       <tx:method name="get*" propagation="REQUIRED" read-only="true" />  
       <tx:method name="find*" propagation="REQUIRED" read-only="true" />  
       <tx:method name="list*" propagation="REQUIRED" read-only="true" />  
       <tx:method name="load*" propagation="REQUIRED" read-only="true" />  
       <tx:method name="select*" propagation="REQUIRED" read-only="true" />  
       <tx:method name="save*" propagation="REQUIRED" rollback-for="Exception"/>  
       <tx:method name="add*" propagation="REQUIRED" rollback-for="Exception"/>  
       <tx:method name="update*" propagation="REQUIRED" rollback-for="Exception"/>  
       <tx:method name="delete*" propagation="REQUIRED" rollback-for="Exception"/>  
       <!-- 其他方法使用默认的事务设置 -->  
       <tx:method name="*" propagation="REQUIRED"/>  
   </tx:attributes>
</tx:advice>

<aop:config>  
    <aop:pointcut id="interceptorPointCuts"
        expression="execution(* com.ffour.yixing.service.impl.*Impl.*(..))" />  
    <aop:advisor advice-ref="txAdvice"  
        pointcut-ref="interceptorPointCuts" />          
</aop:config>    

<bean id="sysUserInfoDao" class="com.ffour.yixing.dao.impl.SysUserInfoDaoImpl"></bean>
<bean id="sysUserInfoSV" class="com.ffour.yixing.service.impl.SysUserInfoImpl">
    <property name="sysUserInfoDao" ref="sysUserInfoDao"></property>
</bean>

<bean id="sysStudentUserInfoDao" class="com.ffour.yixing.dao.impl.SysStudentUserInfoDaoImpl"></bean>
<bean id="sysStudentUserInfoSV" class="com.ffour.yixing.service.impl.SysStudentUserInfoImpl">
    <property name="sysStudentUserInfoDao" ref="sysStudentUserInfoDao"></property>
</bean>

hibernate配置,上面的有的没显示
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">



<!-- 方言配置 -->

org.hibernate.dialect.Oracle10gDialect

<!-- 是否在控制台显示sql -->

true

<!-- 是否自动提交事务 -->

true

<!-- 数据库批量查询最大数 -->

50

<!-- 数据库批量更新,添加,删除操作最大数 -->

20

org.springframework.orm.hibernate4.SpringSessionContext

<!-- 设置自动创建|更新|验证数据库表结构 -->

true

false




需要控制到接口
你的是实现

``` expression="execution(* com.ffour.yixing.service.impl.*Impl.*(..))" />


一般都是注入接口,所以控制也是接口
看看是否set也注入实现了

这么坑,感觉要看全部代码了