{"action":"opened","issue":{"url":"https://api.github.com/repos/jOOQ/jOOQ/issues/3897","labels_url":"https://api.github.com/repos/jOOQ/jOOQ/issues/3897/labels{/name}","comments_url":"https://api.github.com/repos/jOOQ/jOOQ/issues/3897/comments","events_url":"https://api.github.com/repos/jOOQ/jOOQ/issues/3897/events","html_url":"https://github.com/jOOQ/jOOQ/issues/3897","id":53401744,"number":3897,"title":"Add support for nested \"to-one\" POJOs in DefaultRecordMapper","user":{"login":"lukaseder","id":734593,"avatar_url":"https://avatars.githubusercontent.com/u/734593?v=3","gravatar_id":"","url":"https://api.github.com/users/lukaseder","html_url":"https://github.com/lukaseder","followers_url":"https://api.github.com/users/lukaseder/followers","following_url":"https://api.github.com/users/lukaseder/following{/other_user}","gists_url":"https://api.github.com/users/lukaseder/gists{/gist_id}","starred_url":"https://api.github.com/users/lukaseder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukaseder/subscriptions","organizations_url":"https://api.github.com/users/lukaseder/orgs","repos_url":"https://api.github.com/users/lukaseder/repos","events_url":"https://api.github.com/users/lukaseder/events{/privacy}","received_events_url":"https://api.github.com/users/lukaseder/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jOOQ/jOOQ/labels/C%3A+Functionality","name":"C: Functionality","color":"0000aa"},{"url":"https://api.github.com/repos/jOOQ/jOOQ/labels/P%3A+Medium","name":"P: Medium","color":"ffaaaa"},{"url":"https://api.github.com/repos/jOOQ/jOOQ/labels/T%3A+Enhancement","name":"T: Enhancement","color":"cccccc"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/jOOQ/jOOQ/milestones/105","labels_url":"https://api.github.com/repos/jOOQ/jOOQ/milestones/105/labels","id":735859,"number":105,"title":"Version 3.6.0","description":"","creator":{"login":"lukaseder","id":734593,"avatar_url":"https://avatars.githubusercontent.com/u/734593?v=3","gravatar_id":"","url":"https://api.github.com/users/lukaseder","html_url":"https://github.com/lukaseder","followers_url":"https://api.github.com/users/lukaseder/followers","following_url":"https://api.github.com/users/lukaseder/following{/other_user}","gists_url":"https://api.github.com/users/lukaseder/gists{/gist_id}","starred_url":"https://api.github.com/users/lukaseder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukaseder/subscriptions","organizations_url":"https://api.github.com/users/lukaseder/orgs","repos_url":"https://api.github.com/users/lukaseder/repos","events_url":"https://api.github.com/users/lukaseder/events{/privacy}","received_events_url":"https://api.github.com/users/lukaseder/received_events","type":"User","site_admin":false},"open_issues":297,"closed_issues":63,"state":"open","created_at":"2014-07-29T16:27:29Z","updated_at":"2015-01-05T14:36:58Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2015-01-05T14:36:58Z","updated_at":"2015-01-05T14:36:58Z","closed_at":null,"body":"New features like #3884, #3886, etc. rely on a couple of new features also in `DefaultRecordMapper`. One such feature is the ability to map nested POJOs for \"to-one\" relationships. For instance:\r\n\r\n```java\r\nclass Book {\r\n    int id;\r\n    String title;\r\n    Author author;\r\n}\r\n\r\nclass Author {\r\n    String firstName;\r\n    String lastName;\r\n}\r\n```\r\n\r\nInstances of the above types should be materialisable by default via `DefaultRecordMapper`, if column names are properly aliased:\r\n\r\n```sql\r\nSELECT\r\n    b.id,\r\n    b.title,\r\n    a.first_name as \"author.first_name\",\r\n    a.last_name as \"author.last_name\"\r\nFROM\r\n    book b\r\nJOIN\r\n    author a\r\nON b.author_id = a.id\r\n```\r\n\r\nThe `Result` that is thus mapped looks like this:\r\n\r\n```\r\n+----+------------+-----------------+----------------+\r\n|  ID|TITLE       |AUTHOR.FIRST_NAME|AUTHOR.LAST_NAME|\r\n+----+------------+-----------------+----------------+\r\n|   1|1984        |George           |Orwell          |\r\n|   2|Animal Farm |George           |Orwell          |\r\n|   3|O Alquimista|Paulo            |Coelho          |\r\n|   4|Brida       |Paulo            |Coelho          |\r\n+----+------------+-----------------+----------------+\r\n```\r\n\r\nThis notion of emulated nested record by dot notation can be re-used when implementing actual nested records / row expressions as in #3886"}}