我正在使用Spring Data JPA的编程配置,如下所示:
package com.bosch.bip.Utils;
import java.util.Properties;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.apache.commons.dbcp.BasicDataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.data.repository.query.QueryLookupStrategy.Key;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(basePackages="com.bosch.bip.Repositories",queryLookupStrategy=Key.CREATE_IF_NOT_FOUND)
public class PersistentContext {
@Bean
DataSource datasource()
{
BasicDataSource ds=new BasicDataSource();
ds.setUrl("jdbc:oracle:thin:@10.165.18.29:1521:ORCL");
ds.setDriverClassName("oracle.jdbc.driver.OracleDriver");
ds.setUsername("BIPUser");
ds.setPassword("BIP");
return ds;
}
@Bean
LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource ds)
{
LocalContainerEntityManagerFactoryBean emf= new LocalContainerEntityManagerFactoryBean();
emf.setDataSource(ds);
emf.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
emf.setPackagesToScan("com.bosch.bip.Entities");
Properties jpaProperties = new Properties();
jpaProperties.put("hibernate.dialect","org.hibernate.dialect.Oracle10gDialect");
jpaProperties.put("hibernate.hbm2ddl.auto", "update");
jpaProperties.put("hibernate.enable_lazy_load_no_trans", "true");
jpaProperties.put("hibernate.format_sql", "true");
jpaProperties.put("hibernate.show_sql", "true");
emf.setJpaProperties(jpaProperties);
return emf;
}
@Bean
JpaTransactionManager transactionManager(EntityManagerFactory emf)
{
JpaTransactionManager tm= new JpaTransactionManager();
tm.setEntityManagerFactory(emf);
return tm;
}
}
我正在使用自定义存储库来更新数据库中的行,其代码如下:
package com.bosch.bip.Repositories;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;
import com.bosch.bip.Entities.AdapterVersion;
public interface AdapterVersion_REP extends JpaRepository<AdapterVersion, Long>{
@Modifying(clearAutomatically=true)
@Query(value ="update ADAPTER_VERSION av SET av.DESCRIPTION=:description WHERE av.ADAPTER_ID=:adapterId AND av.VERSION=:version",nativeQuery=true )
@Transactional
int updateSelectedAdapterDetails(@Param("description") String description,@Param("adapterId") int adapterId, @Param("version") String serverVersion );
}
当我尝试使用REST客户端执行查询时,控制台只是空白而没有任何操作。 请帮忙,因为我无法解决这个问题。
SQL的日志:
May 11, 2016 1:31:32 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'antiJARLocking' to 'true' did not find a matching property.
May 11, 2016 1:31:32 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:activiti-explorer' did not find a matching property.
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/8.0.30
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Dec 1 2015 22:30:46 UTC
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 8.0.30.0
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 7
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.1
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jre8
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_71-b15
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: C:\Himangshu\WS\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: C:\Users\CHH7KOR\Desktop\apache-tomcat-8.0.30
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:5858
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\Himangshu\WS\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\Users\CHH7KOR\Desktop\apache-tomcat-8.0.30
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=C:\Himangshu\WS\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=C:\Users\CHH7KOR\Desktop\apache-tomcat-8.0.30\endorsed
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
May 11, 2016 1:31:32 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre8\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jdk1.8.0_74/bin/../jre/bin/server;C:/Program Files/Java/jdk1.8.0_74/bin/../jre/bin;C:/Program Files/Java/jdk1.8.0_74/bin/../jre/lib/amd64;C:\Users\CHH7KOR\Documents\Maven\apache-maven-3.3.9\bin;C:\Program Files\Java\jdk1.8.0_74\bin;C:\Program Files (x86)\Maven\apache-maven-3.3.9\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\7-Zip;C:\Program Files (x86)\Toolbase Client;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5\;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5\Doctrine extensions for PHP\;C:\Program Files (x86)\QuickTime\QTSystem;C:\Program Files (x86)\Ant\apache-ant-1.9.6-bin\apache-ant-1.9.6\bin;C:\Program Files (x86)\WebEx\Productivity Tools;C:\Users\CHH7KOR\Downloads\eclipse;;C:\Program Files\WinMagic\SecureDoc-NT\;.
May 11, 2016 1:31:32 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
May 11, 2016 1:31:33 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
May 11, 2016 1:31:33 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
May 11, 2016 1:31:33 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
May 11, 2016 1:31:33 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1387 ms
May 11, 2016 1:31:33 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
May 11, 2016 1:31:33 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.30
May 11, 2016 1:31:33 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [151] milliseconds.
May 11, 2016 1:31:41 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
May 11, 2016 1:31:41 PM org.apache.catalina.core.ApplicationContext log
INFO: Spring WebApplicationInitializers detected on classpath: [com.bosch.bip.RESTfulServices.RESTfulInitializer@1e936f98]
May 11, 2016 1:31:41 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
01:31:41,738 [localhost-startStop-1] INFO org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization started
01:31:41,929 [localhost-startStop-1] INFO org.springframework.web.context.support.AnnotationConfigWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Wed May 11 13:31:41 IST 2016]; root of context hierarchy
01:31:42,067 [localhost-startStop-1] INFO org.springframework.web.context.support.AnnotationConfigWebApplicationContext - Registering annotated classes: [class com.bosch.bip.RESTfulServices.RESTfulConfiguration]
01:31:43,187 [localhost-startStop-1] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/adapters/update],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<java.lang.Object> com.bosch.bip.RESTfulServices.AdapterController_CRUD.createUser(org.springframework.util.MultiValueMap<java.lang.Object, java.lang.Object>)
01:31:43,187 [localhost-startStop-1] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/adapters/allAdapterDetails],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.util.List<java.lang.Object> com.bosch.bip.RESTfulServices.AdapterController_CRUD.serviceForFetchingAllAdapterDetails() throws java.io.IOException
01:31:43,188 [localhost-startStop-1] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/adapters/selectedAdapterDetailsForUpdate/{adapterId}/{serverVersion}],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.util.List<java.lang.Object> com.bosch.bip.RESTfulServices.AdapterController_CRUD.serviceForFetchingSelectedAdapterDetails(java.util.Map<java.lang.Object, java.lang.Object>) throws java.io.IOException
01:31:43,875 [localhost-startStop-1] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter - Looking for @ControllerAdvice: Root WebApplicationContext: startup date [Wed May 11 13:31:41 IST 2016]; root of context hierarchy
01:31:44,072 [localhost-startStop-1] INFO org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 2332 ms
01:31:44,083 [localhost-startStop-1] INFO org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'dispatcher': initialization started
May 11, 2016 1:31:44 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'dispatcher'
01:31:44,148 [localhost-startStop-1] INFO org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'dispatcher': initialization completed in 65 ms
May 11, 2016 1:31:44 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
May 11, 2016 1:31:44 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
May 11, 2016 1:31:44 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 11078 ms
01:31:52,099 [http-nio-8080-exec-2] INFO org.springframework.context.annotation.AnnotationConfigApplicationContext - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@12b5782d: startup date [Wed May 11 13:31:52 IST 2016]; root of context hierarchy
01:31:56,158 [http-nio-8080-exec-2] INFO org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean - Building JPA container EntityManagerFactory for persistence unit 'default'
01:31:56,416 [http-nio-8080-exec-2] INFO org.hibernate.jpa.internal.util.LogHelper - HHH000204: Processing PersistenceUnitInfo [
name: default
...]
01:31:57,686 [http-nio-8080-exec-2] INFO org.hibernate.Version - HHH000412: Hibernate Core {4.3.11.Final}
01:31:57,725 [http-nio-8080-exec-2] INFO org.hibernate.cfg.Environment - HHH000206: hibernate.properties not found
01:31:57,738 [http-nio-8080-exec-2] INFO org.hibernate.cfg.Environment - HHH000021: Bytecode provider name : javassist
01:32:00,394 [http-nio-8080-exec-2] INFO org.hibernate.annotations.common.Version - HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
01:32:02,658 [http-nio-8080-exec-2] INFO org.hibernate.dialect.Dialect - HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
01:32:02,790 [http-nio-8080-exec-2] INFO org.hibernate.engine.jdbc.internal.LobCreatorBuilder - HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
01:32:04,883 [http-nio-8080-exec-2] INFO org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory - HHH000397: Using ASTQueryTranslatorFactory
01:32:09,570 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000228: Running hbm2ddl schema update
01:32:09,571 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000102: Fetching database metadata
01:32:09,860 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000396: Updating schema
01:32:10,679 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.ADAPTER
01:32:10,679 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [name, id, is_client, classification]
01:32:10,680 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: []
01:32:10,681 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [adapter_pk]
01:32:10,746 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.ADAPTER_SERVER_MAP
01:32:10,747 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [adapter_version_id, server_id]
01:32:10,748 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: [adapter_server_map_server_fk, adapter_server_map_adapver_fk]
01:32:10,748 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: []
01:32:10,817 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.ADAPTER_VERSION
01:32:10,817 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [num_recon_attempt, polling_freq, tooltip, jar_path, description, adapter_id, id, category, type, version, status]
01:32:10,818 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: [adapter_version_configval_fkv1, adapter_version_adapter_fk]
01:32:10,819 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [adapter_version_pk]
01:32:10,868 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.CONFIG_TYPE
01:32:10,868 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [id, type, value]
01:32:10,869 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: []
01:32:10,870 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [configuration_pk]
01:32:10,911 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.CONFIG_VALUE
01:32:10,911 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [config_value, id, config_type]
01:32:10,912 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: [config_value_config_type_fk]
01:32:10,913 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [config_value_pk]
01:32:10,956 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.FEATURE
01:32:10,956 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [feature, id]
01:32:10,957 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: []
01:32:10,957 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [feature_pk]
01:32:11,003 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.SERVER
01:32:11,003 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [server, id, server_version]
01:32:11,004 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: [server_adapter_fk]
01:32:11,004 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [server_pk]
01:32:11,049 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.SERVICE_ORCHESTRATION
01:32:11,049 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [orchestration_value, orchestration_name, id]
01:32:11,050 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: []
01:32:11,051 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [service_orchestration_pk]
01:32:11,092 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.TEMPLATE
01:32:11,092 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [feature_id, template, id, language_id]
01:32:11,093 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: [template_language_fk, template_feature_fk]
01:32:11,094 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [template_pk]
01:32:11,201 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.LANGUAGE
01:32:11,201 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [language, id]
01:32:11,202 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: []
01:32:11,203 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [language_pk]
01:32:11,216 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000232: Schema update complete
hadfaj3
Hibernate:
update
ADAPTER_VERSION av
SET
av.DESCRIPTION=?
WHERE
av.ADAPTER_ID=?
AND av.VERSION=?
答案 0 :(得分:1)
请将其更改为以下内容并尝试:
@Modifying(clearAutomatically=true)
@Query(value ="update ADAPTER_VERSION av SET av.DESCRIPTION=:description WHERE av.ADAPTER_ID=:adapterId AND av.VERSION=:version",nativeQuery=true )
void updateSelectedAdapterDetails(@Param("description") String description,@Param("adapterId") int adapterId, @Param("version") String serverVersion );
将事务移动到服务/组件,调用更新函数。