{"action":"created","issue":{"url":"https://api.github.com/repos/kittylyst/VillagePaymentAgent/issues/56","labels_url":"https://api.github.com/repos/kittylyst/VillagePaymentAgent/issues/56/labels{/name}","comments_url":"https://api.github.com/repos/kittylyst/VillagePaymentAgent/issues/56/comments","events_url":"https://api.github.com/repos/kittylyst/VillagePaymentAgent/issues/56/events","html_url":"https://github.com/kittylyst/VillagePaymentAgent/issues/56","id":59337086,"number":56,"title":"Intro task - findOne(id) and findAll() methods in each DAO","user":{"login":"gratiartis","id":200618,"avatar_url":"https://avatars.githubusercontent.com/u/200618?v=3","gravatar_id":"","url":"https://api.github.com/users/gratiartis","html_url":"https://github.com/gratiartis","followers_url":"https://api.github.com/users/gratiartis/followers","following_url":"https://api.github.com/users/gratiartis/following{/other_user}","gists_url":"https://api.github.com/users/gratiartis/gists{/gist_id}","starred_url":"https://api.github.com/users/gratiartis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gratiartis/subscriptions","organizations_url":"https://api.github.com/users/gratiartis/orgs","repos_url":"https://api.github.com/users/gratiartis/repos","events_url":"https://api.github.com/users/gratiartis/events{/privacy}","received_events_url":"https://api.github.com/users/gratiartis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-02-28T10:44:27Z","updated_at":"2015-03-01T13:55:14Z","closed_at":null,"body":"A proposal for a reasonably simple intro task.\r\n\r\nA couple of benefits:\r\n - Follows the Spring Data repository interface naming convention, facilitating that migration.\r\n - Enables the removal of iterating through lists in `VerifierServiceImpl` for find entities by ID.\r\n\r\nFollowing a test-driven approach, the general approach could be to create a test such as:\r\n\r\n    @RunWith(SpringJUnit4ClassRunner.class)\r\n    @ContextConfiguration(locations = \"/applicationContext.xml\")\r\n    public class DaoTest {\r\n    \r\n        @Autowired\r\n        private RegionDAO regionDao;\r\n        \r\n        @Test\r\n        public void shouldFindRegionById() {\r\n            Region region = regionDao.findOne(1);\r\n            assertNotNull(region);\r\n        }\r\n    \r\n    }\r\n\r\n... and an implementation such as:\r\n\r\n    public Region findOne(int regionId) {\r\n        @SuppressWarnings(\"unchecked\")\r\n        List<Region> regions = getHibernateTemplate().find(\"from Region r where r.id = ?\", regionId);\r\n        if (regions.size() == 0) {\r\n            return null;\r\n        }\r\n        return regions.get(0);\r\n    }\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/kittylyst/VillagePaymentAgent/issues/comments/76597658","html_url":"https://github.com/kittylyst/VillagePaymentAgent/issues/56#issuecomment-76597658","issue_url":"https://api.github.com/repos/kittylyst/VillagePaymentAgent/issues/56","id":76597658,"user":{"login":"wjam","id":3914751,"avatar_url":"https://avatars.githubusercontent.com/u/3914751?v=3","gravatar_id":"","url":"https://api.github.com/users/wjam","html_url":"https://github.com/wjam","followers_url":"https://api.github.com/users/wjam/followers","following_url":"https://api.github.com/users/wjam/following{/other_user}","gists_url":"https://api.github.com/users/wjam/gists{/gist_id}","starred_url":"https://api.github.com/users/wjam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjam/subscriptions","organizations_url":"https://api.github.com/users/wjam/orgs","repos_url":"https://api.github.com/users/wjam/repos","events_url":"https://api.github.com/users/wjam/events{/privacy}","received_events_url":"https://api.github.com/users/wjam/received_events","type":"User","site_admin":false},"created_at":"2015-03-01T13:55:14Z","updated_at":"2015-03-01T13:55:14Z","body":"Note that when we've moved to Spring 4, the DAOs will all get replaced by a simple interface (issue #25)\r\n"}}