在内存中使用 Apache Derby 时发出警告
我有许多单元测试,它们在内存中使用 Apache Derby。 我的连接 URL 是:jdbc:derby:memory:srf.derby;create=true
我发现每次标记为 @Transactional
的方法完成时,我都会收到德比警告
12:53:28:5328 [org.hibernate.util.JDBCExceptionReporter] [main] WARN - SQL Warning: 10000, SQLState: 01J01
12:53:28:5328 [org.hibernate.util.JDBCExceptionReporter] [main] WARN - Database 'memory:srf.derby' not created, connection made to existing database instead.
是为什么呢?我做错了什么?
谢谢
I have a number of unit tests, which use Apache Derby in memory.
My connection url is: jdbc:derby:memory:srf.derby;create=true
I discovered that each time, when a method marked as @Transactional
is finishing, I receive a Derby warning
12:53:28:5328 [org.hibernate.util.JDBCExceptionReporter] [main] WARN - SQL Warning: 10000, SQLState: 01J01
12:53:28:5328 [org.hibernate.util.JDBCExceptionReporter] [main] WARN - Database 'memory:srf.derby' not created, connection made to existing database instead.
Why is it? What I'm doing wrong?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你没有做错任何事。您每次都会传递“;create=true”,但数据库仅在程序第一次访问它时创建。由于它位于内存中,因此数据库会一直挂起,直到程序退出,此时它就会消失。
您可以通过仅在测试套件中的第一个测试上传递“;create=true”来避免警告,然后后续测试不需要传递该值。
或者,您可以不担心该警告。
You're not doing anything wrong. You're passing ';create=true' each time, but the database is only created the first time your program accesses it. Since it's in-memory, the database then hangs around until your program exits, at which point it disappears.
You could avoid the warning by passing ';create=true' only on the first test in your test suite, and then subsequent tests do not need to pass that value.
Or, you could just not worry about the warning.