{"action":"created","issue":{"url":"https://api.github.com/repos/jdbi/jdbi/issues/532","repository_url":"https://api.github.com/repos/jdbi/jdbi","labels_url":"https://api.github.com/repos/jdbi/jdbi/issues/532/labels{/name}","comments_url":"https://api.github.com/repos/jdbi/jdbi/issues/532/comments","events_url":"https://api.github.com/repos/jdbi/jdbi/issues/532/events","html_url":"https://github.com/jdbi/jdbi/issues/532","id":183725188,"number":532,"title":"Give reflection-based row mappers a column name prefix option","user":{"login":"qualidafial","id":38629,"avatar_url":"https://avatars.githubusercontent.com/u/38629?v=3","gravatar_id":"","url":"https://api.github.com/users/qualidafial","html_url":"https://github.com/qualidafial","followers_url":"https://api.github.com/users/qualidafial/followers","following_url":"https://api.github.com/users/qualidafial/following{/other_user}","gists_url":"https://api.github.com/users/qualidafial/gists{/gist_id}","starred_url":"https://api.github.com/users/qualidafial/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qualidafial/subscriptions","organizations_url":"https://api.github.com/users/qualidafial/orgs","repos_url":"https://api.github.com/users/qualidafial/repos","events_url":"https://api.github.com/users/qualidafial/events{/privacy}","received_events_url":"https://api.github.com/users/qualidafial/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"qualidafial","id":38629,"avatar_url":"https://avatars.githubusercontent.com/u/38629?v=3","gravatar_id":"","url":"https://api.github.com/users/qualidafial","html_url":"https://github.com/qualidafial","followers_url":"https://api.github.com/users/qualidafial/followers","following_url":"https://api.github.com/users/qualidafial/following{/other_user}","gists_url":"https://api.github.com/users/qualidafial/gists{/gist_id}","starred_url":"https://api.github.com/users/qualidafial/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qualidafial/subscriptions","organizations_url":"https://api.github.com/users/qualidafial/orgs","repos_url":"https://api.github.com/users/qualidafial/repos","events_url":"https://api.github.com/users/qualidafial/events{/privacy}","received_events_url":"https://api.github.com/users/qualidafial/received_events","type":"User","site_admin":false},"assignees":[{"login":"qualidafial","id":38629,"avatar_url":"https://avatars.githubusercontent.com/u/38629?v=3","gravatar_id":"","url":"https://api.github.com/users/qualidafial","html_url":"https://github.com/qualidafial","followers_url":"https://api.github.com/users/qualidafial/followers","following_url":"https://api.github.com/users/qualidafial/following{/other_user}","gists_url":"https://api.github.com/users/qualidafial/gists{/gist_id}","starred_url":"https://api.github.com/users/qualidafial/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qualidafial/subscriptions","organizations_url":"https://api.github.com/users/qualidafial/orgs","repos_url":"https://api.github.com/users/qualidafial/repos","events_url":"https://api.github.com/users/qualidafial/events{/privacy}","received_events_url":"https://api.github.com/users/qualidafial/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/jdbi/jdbi/milestones/3","html_url":"https://github.com/jdbi/jdbi/milestones/JDBI%203%20Beta%20blocker","labels_url":"https://api.github.com/repos/jdbi/jdbi/milestones/3/labels","id":1788535,"number":3,"title":"JDBI 3 Beta blocker","description":"","creator":{"login":"stevenschlansker","id":129097,"avatar_url":"https://avatars.githubusercontent.com/u/129097?v=3","gravatar_id":"","url":"https://api.github.com/users/stevenschlansker","html_url":"https://github.com/stevenschlansker","followers_url":"https://api.github.com/users/stevenschlansker/followers","following_url":"https://api.github.com/users/stevenschlansker/following{/other_user}","gists_url":"https://api.github.com/users/stevenschlansker/gists{/gist_id}","starred_url":"https://api.github.com/users/stevenschlansker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevenschlansker/subscriptions","organizations_url":"https://api.github.com/users/stevenschlansker/orgs","repos_url":"https://api.github.com/users/stevenschlansker/repos","events_url":"https://api.github.com/users/stevenschlansker/events{/privacy}","received_events_url":"https://api.github.com/users/stevenschlansker/received_events","type":"User","site_admin":false},"open_issues":15,"closed_issues":99,"state":"open","created_at":"2016-05-25T21:46:37Z","updated_at":"2016-10-30T23:04:26Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2016-10-18T15:43:00Z","updated_at":"2016-11-08T06:34:17Z","closed_at":null,"body":"Applies to: `BeanMapper`, `ConstructorMapper`, `FieldMapper`.\n\nThe specific use case I have in mind is with join row mappers:\n\n``` java\nclass File {\n  int id;\n  String name;\n  String contents;\n}\n\nclass Directory {\n  int id;\n  String name;\n  List<File> files;\n}\n```\n\nI can't use reflection-based mappers with `JoinRowMapper` here, because the classes share the same property names. However if I could get a mapper that applies a column name prefix e.g. `f_` and `d_`, then I could exploit those prefixes to disambiguate those common property names:\n\nFluent:\n\n``` java\nhandle.createQuery(\"select d.id d_id, d.name d_name, \" +\n    \"f.id f_id, f.name f_name, f.contents f_contents \" +\n    \"from directories d left join files f on d.id = f.directory_id\")\n    .registerRowMapper(BeanMapperFactory.forType(\"f_\", File.class))\n    .registerRowMapper(BeanMapperFactory.forType(\"d_\", Directory.class))\n    .map(JoinRowMapper.forTypes(Directory.class, File.class))\n    .list();\n```\n\nSQL Object:\n\n``` java\n@RegisterBeanMapper(value={File.class,Directory.class}, prefix={\"f_\", \"d_\"})\n@RegisterJoinRowMapper({File.class, Directory.class})\n@SqlQuery(\"select d.id d_id, d.name d_name, \" +\n    \"f.id f_id, f.name f_name, f.contents f_contents \" +\n    \"from directories d left join files f on d.id = f.directory_id\")\nList<JoinRow> listFiles();\n```\n"},"comment":{"url":"https://api.github.com/repos/jdbi/jdbi/issues/comments/259057524","html_url":"https://github.com/jdbi/jdbi/issues/532#issuecomment-259057524","issue_url":"https://api.github.com/repos/jdbi/jdbi/issues/532","id":259057524,"user":{"login":"qualidafial","id":38629,"avatar_url":"https://avatars.githubusercontent.com/u/38629?v=3","gravatar_id":"","url":"https://api.github.com/users/qualidafial","html_url":"https://github.com/qualidafial","followers_url":"https://api.github.com/users/qualidafial/followers","following_url":"https://api.github.com/users/qualidafial/following{/other_user}","gists_url":"https://api.github.com/users/qualidafial/gists{/gist_id}","starred_url":"https://api.github.com/users/qualidafial/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qualidafial/subscriptions","organizations_url":"https://api.github.com/users/qualidafial/orgs","repos_url":"https://api.github.com/users/qualidafial/repos","events_url":"https://api.github.com/users/qualidafial/events{/privacy}","received_events_url":"https://api.github.com/users/qualidafial/received_events","type":"User","site_admin":false},"created_at":"2016-11-08T06:34:16Z","updated_at":"2016-11-08T06:34:16Z","body":"Fix in #552"}}
{"actor":{"display_login":"qualidafial"}}