{"action":"created","issue":{"url":"https://api.github.com/repos/springtestdbunit/spring-test-dbunit/issues/104","repository_url":"https://api.github.com/repos/springtestdbunit/spring-test-dbunit","labels_url":"https://api.github.com/repos/springtestdbunit/spring-test-dbunit/issues/104/labels{/name}","comments_url":"https://api.github.com/repos/springtestdbunit/spring-test-dbunit/issues/104/comments","events_url":"https://api.github.com/repos/springtestdbunit/spring-test-dbunit/issues/104/events","html_url":"https://github.com/springtestdbunit/spring-test-dbunit/issues/104","id":152535306,"number":104,"title":"Column not found exception, with @ExpectedDatabase","user":{"login":"vict0r81","id":8981423,"avatar_url":"https://avatars.githubusercontent.com/u/8981423?v=3","gravatar_id":"","url":"https://api.github.com/users/vict0r81","html_url":"https://github.com/vict0r81","followers_url":"https://api.github.com/users/vict0r81/followers","following_url":"https://api.github.com/users/vict0r81/following{/other_user}","gists_url":"https://api.github.com/users/vict0r81/gists{/gist_id}","starred_url":"https://api.github.com/users/vict0r81/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vict0r81/subscriptions","organizations_url":"https://api.github.com/users/vict0r81/orgs","repos_url":"https://api.github.com/users/vict0r81/repos","events_url":"https://api.github.com/users/vict0r81/events{/privacy}","received_events_url":"https://api.github.com/users/vict0r81/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-02T11:25:45Z","updated_at":"2016-06-17T11:38:44Z","closed_at":null,"body":"Hey.\r\nI'm very keen on your helpful framework, thanks!\r\n\r\nBut some days ago I get the issue with @ExpectedDatabase annotation and table, names `users`. When I was running my tests, unexpectedly I've found message, that column `admin` can't be found for table `users`. That was weird, 'cause I have not had that column neither under my entity mappings nor under expected datasets.\r\nSo I've started a little investigation, and found, that H2 has its own table, named `users` as well. Here is the link with H2 information schema description: http://www.h2database.com/html/grammar.html#information_schema\r\nBut, when I was doing my checks w.o. using ExpectedDatabase annotations everything went fine. I had not had any similar exceptions.\r\nSo, when I was in debug, I've found, that table's metadata, that populated during test indeed contained `admin` column from H2 own users table, and merged my table structure. \r\nSo I decided to wrote a little test project to illustrate this issue, you could simple try by cloning my repository: [https://github.com/vict0r81/spring-dbunit-test](https://github.com/vict0r81/spring-dbunit-test)\r\n\r\nHope my description will help you to bother that kind of problem.\r\n\r\nThanks, \r\nVictor."},"comment":{"url":"https://api.github.com/repos/springtestdbunit/spring-test-dbunit/issues/comments/226747829","html_url":"https://github.com/springtestdbunit/spring-test-dbunit/issues/104#issuecomment-226747829","issue_url":"https://api.github.com/repos/springtestdbunit/spring-test-dbunit/issues/104","id":226747829,"user":{"login":"FingolfinTEK","id":1016932,"avatar_url":"https://avatars.githubusercontent.com/u/1016932?v=3","gravatar_id":"","url":"https://api.github.com/users/FingolfinTEK","html_url":"https://github.com/FingolfinTEK","followers_url":"https://api.github.com/users/FingolfinTEK/followers","following_url":"https://api.github.com/users/FingolfinTEK/following{/other_user}","gists_url":"https://api.github.com/users/FingolfinTEK/gists{/gist_id}","starred_url":"https://api.github.com/users/FingolfinTEK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FingolfinTEK/subscriptions","organizations_url":"https://api.github.com/users/FingolfinTEK/orgs","repos_url":"https://api.github.com/users/FingolfinTEK/repos","events_url":"https://api.github.com/users/FingolfinTEK/events{/privacy}","received_events_url":"https://api.github.com/users/FingolfinTEK/received_events","type":"User","site_admin":false},"created_at":"2016-06-17T11:38:44Z","updated_at":"2016-06-17T11:38:44Z","body":"You need to use the public schema in combination with an escape pattern and everything should work correctly:\r\n\r\n```\r\n@Configuration\r\npublic static class DbUnitConfiguration {\r\n\r\n    @Bean\r\n    public DatabaseConfigBean dbUnitDatabaseConfig() {\r\n        final DatabaseConfigBean bean = new DatabaseConfigBean();\r\n        bean.setDatatypeFactory(new H2DataTypeFactory());\r\n        bean.setEscapePattern(\"`\");\r\n        return bean;\r\n    }\r\n\r\n    @Bean\r\n    public DatabaseDataSourceConnectionFactoryBean dbUnitDatabaseConnection(\r\n        DataSource dataSource) {\r\n        final DatabaseDataSourceConnectionFactoryBean bean =\r\n            new DatabaseDataSourceConnectionFactoryBean(dataSource);\r\n        bean.setDatabaseConfig(dbUnitDatabaseConfig());\r\n        bean.setSchema(\"public\");\r\n        return bean;\r\n    }\r\n}\r\n```"}}
{"actor":{"display_login":"FingolfinTEK"}}