Session session = this.getSessionFactory().getCurrentSession();
session.save(entity);可以执行
session.update(entity)方法怎么不执行,什么情况,求大神指点,以下是spring配置文件:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd"
default-autowire="byName">
<!-- 打开注解支持 -->
<context:annotation-config ></context:annotation-config>
<!-- 启动对@Aspects注解的支持 -->
<aop:aspectj-autoproxy></aop:aspectj-autoproxy>
<!-- i18n Resource文件bundles -->
<bean scope="singleton" id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basenames">
<list>
<value>i18n/messages</value>
<value>i18n/errors</value>
</list>
</property>
</bean>
<bean scope="singleton" id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath*:conf/jdbc.properties</value>
<value>classpath*:conf/hibernate.properties</value>
</list>
</property>
</bean>
<!-- 配置数据源 -->
<bean scope="singleton" id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<!-- 连接池启动时的初始值 -->
<property name="initialSize" value="1" />
<!-- 连接池的最大连接数 -->
<property name="maxActive" value="500" />
<!-- 最大空闲时,当经过一个高峰时间后,连接池可以慢慢释放一些连接,一直减少到maxIdle为止 -->
<property name="maxIdle" value="2" />
<!-- 最小空闲数,当空闲的连接数少于阀值时,连接池会预申请去一些连接,以免洪峰来时来不及申请 -->
<property name="minIdle" value="1" />
<property name="logAbandoned" value="true" />
<property name="removeAbandoned" value="true" />
<property name="removeAbandonedTimeout" value="1000" />
<property name="maxWait" value="1000" />
</bean>
<!-- 通过JDBC模版获取数据库连接 -->
<bean scope="singleton" id="jdbcTemplate"
class="org.springframework.jdbc.core.JdbcTemplate" >
</bean>
<!-- Spirng 对clob blob数据的处理 -->
<bean scope="singleton" id="lobHandler"
class="org.springframework.jdbc.support.lob.DefaultLobHandler"
lazy-init="true" >
</bean>
<bean scope="singleton" id="nativeJdbcExtractor"
class="org.springframework.jdbc.support.nativejdbc.CommonsDbcpNativeJdbcExtractor"
lazy-init="true" >
</bean>
<!--
<bean scope="singleton" id="interceptorsProxy" class="com.internetphoto.common.InterceptorsProxy">
</bean>
-->
<!-- 对Hibernate SessionFatory创建的session进行配置 -->
<bean scope="singleton" id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="mappingDirectoryLocations">
<list>
<value>classpath*:/com/internetphoto/login/**/entity</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.jdbc.batch_size">${hibernate.jdbc.batch_size}</prop>