Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warning when using Apache Derby in memory

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

like image 459
Pavel Bernshtam Avatar asked Mar 24 '11 10:03

Pavel Bernshtam


1 Answers

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.

like image 168
Bryan Pendleton Avatar answered Jan 01 '23 23:01

Bryan Pendleton