`
no7beckham
  • 浏览: 94787 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

spring test中update的测试

    博客分类:
  • JAVA
阅读更多
public class MethodMockDaoTest extends AbstractTransactionalDataSourceSpringContextTests {
...
public void testUpdateWithCharactorCN()
    MethodMock mm = methodMockDao.get("foo");
    mm.setImplement("哈哈哈哈哈");
    methodMockDao.update(mm);
    MethodMock mm1 = methodMockDao.get("foo");
    assertEquals("哈哈哈哈哈", mm1.getImplement());
}
}

发现这样写竟然报错,晕死,update的东西没有更新到数据库中
看了看AbstractTransactionalDataSourceSpringContextTests的源码,
发现在update后面跟上一句
this.transactionManager.commit(this.transactionStatus);
就OK了,哈哈
分享到:
评论
1 楼 east_java 2008-11-29  
这样子,数据就提交到数据库了.不会再回滚啊..

相关推荐

    spring 最新框架jar

    [Git][] and [JDK 8 update 20 or later][JDK8 build] Be sure that your `JAVA_HOME` environment variable points to the `jdk1.8.0` folder extracted from the JDK download. ### Check out sources `git ...

    spring 高性能 代码

    //以下是我的测试用例 //@Test 查询基本类型 public void testObject() throws Exception{ Finder finder=new Finder("select id from [Users] where 1=1 "); finder.append("and userId=:userId").setParam(...

    spring-boot-reference.pdf

    Using Spock to Test Spring Boot Applications 43.4. Test Utilities 43.4.1. ConfigFileApplicationContextInitializer 43.4.2. TestPropertyValues 43.4.3. OutputCapture 43.4.4. TestRestTemplate 44. ...

    spring-cloud-stream-event-event-sourcing-testcontainers:目标:创建一个Spring Boot应用程序,该应用程序使用Event Sourcing处理用户。 因此,无论何时创建,更新或删除用户,通知此更改的事件都会发送到Kafka。 同样,我们将实现另一个应用程序,该应用程序侦听这些事件并将其保存在Cassandra中。 最后,将使用Testcontainer运行集成测试

    Spring云流事件采购测试容器这个项目的目标是创建一个应用程序,该应用程序使用处理users 。 因此,除了传统的create / update / delete之外,每当创建,更新或删除用户时,都会向发送通知此更改的事件。 此外,我们...

    springmybatis

    在test_src 源码目录下建立com.yihaomen.test这个package,并建立测试类Test: 程序代码 程序代码 package com.yihaomen.test; import java.io.Reader; import org.apache.ibatis.io.Resources; import org.apache....

    spring_MVC源码

    弃用了struts,用spring mvc框架做了几个项目,感觉都不错,而且使用了注解方式,可以省掉一大堆配置文件。本文主要介绍使用注解方式配置的spring mvc,之前写的spring3.0 mvc和rest小例子没有介绍到数据层的内容,...

    Learning Spring 5.0

    You will then learn how to secure and test your applications using the Spring-test and Spring-Security modules. At the end, you will enhance your development skills by getting to grips with the ...

    ssh(structs,spring,hibernate)框架中的上传下载

     文件数据存储在Blob类型的FILE_CONTENT表字段上,在Spring中采用OracleLobHandler来处理Lob字段(包括Clob和Blob),由于在程序中不需要引用到oracle数据驱动程序的具体类且屏蔽了不同数据库处理Lob字段方法上的...

    spring-framework-reference-4.1.2

    3. New Features and Enhancements in Spring Framework 4.0 ............................................ 17 3.1. Improved Getting Started Experience .........................................................

    senior-pdv:Java + JavaFX +Spring启动

    如果依赖项存在错误,请运行命令Maven > update project ,然后Run As > maven install ; 配置数据库连接: 创建senior_pdv和senior_pdv_test模式; 在文件中配置连接URL,用户和密码: src/main/resources/...

    springboottest1:提供宁静API的后端应用

    8080 / productcatalog / {id}->删除具有此id的产品消耗= MediaType.APPLICATION_JSON_VALUE PUT localhost:8080 / productcatalog / update / {id}->在数据库消耗= MediaType.APPLICATION_JSON_VALUE中使用此ID...

    spring-mybatis-jetty:基于Spring+Mybatis+Jetty实现简单的用户信息接口

    在执行项目之前,需要添加integration数据库用户,或者修改项目中的用户。 执行命令 mvn sql:execute 注:执行完以后,更新项目(Update Project)即可以看到数据库。 或者使用`mvn clean package`执行可执行sql语句...

    spring-framework-reference4.1.4

    3. New Features and Enhancements in Spring Framework 4.0 ............................................ 17 3.1. Improved Getting Started Experience .........................................................

    JdbcTemplateTool.zip

    BatchPreparedStatementSetter, 就可以批量update通过一个对PO对象删除对应的数据库记录依然可以使用原始的JdbcTemplate目前只在mysql上测试.Maven 依赖  <groupId>org.crazycake  <artifactId>jdbctemplatetool ...

    datav-webapi-spring:DataV的演示API服务器

    DataV工具热图飞行路线测试并运行mvn testmvn spring-boot:runopen ...sample docker ID: kenali (update to your ID in pom.xml docker.image.prefix)mvn dockerfile:buildmvn dockerfile:push# run manually in case ...

    我的主意:允许人们贡献他们对产品功能的有趣想法

    使它更好 What is it ? Java Web应用程序,使每个人都可以将自己的绝妙想法贡献给某些产品。 Build with ... 单元测试还将集成测试放置在/ test文件夹下 为了进行测试,我们可以打开Eclipse IDE或IntelliJ

    客户关系管理系统框架搭建(二)

    <property name="hibernate.hbm2ddl.auto">update <property name="hibernate.show_sql">true * 测试.放置在junit包下 public class TestHibernate { @Test public ...

    Grails权威指南

    第1章 寻找grails之旅  1.1 java的困惑  1.2 webc2.0时代  1.3 java的力量 ... 11.4 在grails中使用spring控制器  11.5 在grails中使用acegi  11.6 使用xfire创建soap服务  11.7 本章小结

    博客推荐系统源码

    3. 修改applicationContext.xml文件中的自动生成表的配置(hibernate.hbm2ddl.auto),第一次启动为create,后面改为update; 4. 启动服务器,运行test目录下面的DataGenerator.java、运行src/data目录下面的...

    SSH第7章上机.zip ACCP8.0

    无需写hibernate的配置文件,而是将hibernate的配置直接加入到spring配置文件中 配置hibernate的映射文件地址 --> <value>com/direct/domain/Employee.hbm.xml</value> <value>...

Global site tag (gtag.js) - Google Analytics