Closed attrobit closed 6 years ago
Hi. This is not yet supported (Nobody was asking for it in the past).
I see two options to implement it:
The first would be the preferred approach from my point of view and also relatively straight forward to implement. The DbUnitDatabaseConnectionDecorator
class could load the config file (e.g. dbunit.properties
) and apply it to the dbunit connection. If you like, you can implement it by yourself and open a Pull Request. Alternatively you'll have to wait until I add it (Might take some time).
Regards, Dimitrij
What would be the disadvantage of always setting a schema? (See https://github.com/groie/jpa-unit/commit/c5e68216ad2fcd0e38abab0f2fdc56389af029a9)
In our case when we run the tests against OracleDB DBUnit getTables is run with schemaName=null. This causes DBUnit to scan all our database tables which in turn takes about 20-30 seconds extra every time I run the tests.
So with this optimization I brought our usecase down from 30s to 3s... but I am not sure whether it is backwards compatible in every case.
To be honest, I don't see any disadvantages. That would even be more aligned with the jpa-unit approach to "recognize" the needed settings, without relying on additional configuration.
I am however also not sure about any backwards compatibility issues.
If you like, you can create a PR for your enhancement. I'll however have to verify how other dialects behave before releasing it.
I am not sure how much of a problem that is with the other databases than Oracle. With oracle the request to catalog (ALL_USERS) provides us with 10+ Schemas with lots of Tables. Other DBs might work differently, but reagardless I do agree I would expect JPA-Unit to work the same way for each dialect.
I'll refactor the Oracle10ConnectionFactory to fall back to creating a connection without schema in case of an exception reading the Schema name. I'll add a test or two as well and send a pull request your way. Thanks for quick feedback!
You're very welcome. :) I'll see what I can do for other dialects, when your PR is there. Looking forward to see it.
PR #41 (thanks @groie) is merged and adds support for Oracle RDBMs. Like written above, I'm going to do the same for other dialects and bake a new release then (presumably end of next week).
Much appreciated! Looking forward to rolling out Jpa-unit to our internal dev-teams as a lightweight alternative to Arquillian!
Hi @dadrus, is there something I could do to help you to get the new release done?
Hi @groie, please excuse me for the very belated answer. The last two weeks were pretty exhaustive.
Nevertheless the promised update is ready. You can find it in the 39-setting_dbunit_properties_and_schema_type branch. Please check it out to verify it still works with Oracle. I don't have the possibility to test that database. Actually there is nothing which could break the support. But just to be sure :)
The support for dbunit properties is added there as well.
Thanks for the update @dadrus. I realize you have already merged this branch. Regardless I gave all the changes a look and so far they look good to me. I'll open a story to our backlog to tests the changes as soon as possible.
You are very welcome:) Do you want to have a released version for that?
Released version would be great! Right now we're publishing a patched version to our internal maven-repository, but as soon as the next release hits the maven central we'll change to that!
Hello,
is it possible to set dbunit properties for example "http://www.dbunit.org/features/qualifiedTableNames"?
How can i set the schema?
cheers, attrobit