如何配置 derby 在每个单元/集成测试之间不删除我的数据库?我想保留运行之间的数据。
dbDialect=DERBY
XADataSourceClassName=org.apache.derby.jdbc.ClientXADataSource
databaseName=ForumThreadDB
createDatabase=update
serverName=localhost
portNumber=1527
DriverClassName=org.apache.derby.jdbc.ClientDriver
url=jdbc:derby://localhost:1527/ForumThreadDB;create=true
user=APP
password=whatever
我刚刚尝试连接到外面的 Derby 。有可能事情永远不会持久化,虽然我在持久化时没有出错,但我记得以前发生过这种情况。
我在测试启动时也遇到了这个错误
---> WARN o.Runtime - An error occurred while registering a ClassTransformer with PersistenceUnitInfo: name 'ForumThreadDomainPU', root URL [file:/C:/Projects/OurForum/ForumThreadDomain/target/classes/]. The error has been consumed. To see it, set your openjpa.Runtime log level to TRACE. Load-time class transformation will not be available.
最佳答案
我想这可能更多地与 Junit 设置有关 尝试添加
@Rollback(value=false)
在你不希望持久化回滚的方法之前
关于java - Derby ,Java EE。对文件数据库运行集成测试,不会被丢弃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9227029/