我使用Spring、Hibernate和MySQL开发应用程序。我为我的一张桌子创建了DAO。现在,我想测试DAO的方法(保存、查找等)。问题是这些方法会影响数据库数据,所以我希望在特定方法执行后回滚所有更改。我尝试通过在defaultRollback=true中设置@TransactionConfiguration来做到这一点,但是它不起作用。下面我粘贴最重要的代码片段。有人知道如何在每个方法之后强制回滚吗?
我在MySQL中的表使用InnoDB引擎。实际上,测试执行控制台包含以下信息:INFO: Rolled back transaction after test execution fo
我正在尝试将hibernate实体管理器与mysql和glassfish结合使用。我在尝试使用JTA数据源时遇到以下错误:
Caused by: org.hibernate.HibernateException: The chosen transaction strategy requires access to the JTA TransactionManager
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:376)
at org.hibernate
我得到以下错误
Caused by: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.jdbc.Abstr
请有人为我总结一下我正在使用的在Tomcat下运行的JAVA的方法吗?这个特定的Servlet没有框架,但是使用了服务器/客户端服务,在这里我为客户端用户请求编写了支持后端类和方法。在这些后端自定义类中,我使用Hibernate (希望使用c3p0连接池管理),Hibernate连接到驻留的MySql服务器。
Right now, it appears as though I've forced everything to work by pushing Hibernate JAR's and C3P0 JAR's and JDBC JAR's under