{"id":1311,"date":"2018-04-22T17:23:04","date_gmt":"2018-04-22T08:23:04","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=1311"},"modified":"2023-05-27T20:41:52","modified_gmt":"2023-05-27T11:41:52","slug":"%e3%80%90%e3%83%87%e3%82%b6%e3%82%a4%e3%83%b3%e3%83%91%e3%82%bf%e3%83%bc%e3%83%b3%e3%80%91dao-dto%e3%83%91%e3%82%bf%e3%83%bc%e3%83%b3","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=1311","title":{"rendered":"\u3010\u30c7\u30b6\u30a4\u30f3\u30d1\u30bf\u30fc\u30f3\u3011DAO\/DTO\u30d1\u30bf\u30fc\u30f3"},"content":{"rendered":"<p>Web\u30a2\u30d7\u30ea\u3067\u3001JDBC\u3092\u5229\u7528\u3057\u305f\u30a2\u30d7\u30ea\u3092\u4f5c\u6210\u3059\u308b\u5834\u5408\u306f\u3001DAO\/DTO\u30d1\u30bf\u30fc\u30f3\u3068\u3044\u3046\u8a2d\u8a08\u304c\u826f\u304f\u4f7f\u308f\u308c\u307e\u3059\u3002<\/p>\n<h2>DAO\u3068\u306f\uff1f<\/h2>\n<p>DAO\u306f\u3001\u300cData Access Object\u300d\u306e\u7565\u3067\u3001<strong>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3078\u30a2\u30af\u30bb\u30b9\u3059\u308b\u5c02\u7528\u306e\u30af\u30e9\u30b9\u3092\u4f5c\u308a\u307e\u3057\u3087\u3046<\/strong>\u3068\u3044\u3046\u30d1\u30bf\u30fc\u30f3\u3067\u3059\u3002<\/p>\n<h3>\u30e1\u30ea\u30c3\u30c8<\/h3>\n<ul>\n<li>\u5f79\u5272\u3092\u660e\u78ba\u5316\u3067\u304d\u308b\u3002<\/li>\n<li>\u8907\u6570\u306e\u30af\u30e9\u30b9\u304b\u3089\u306e\u518d\u5229\u7528\u6027\u3001\u4fdd\u5b88\u6027\u304c\u9ad8\u307e\u308b\u3002<\/li>\n<\/ul>\n<h3>\u5b9f\u88c5\u4f8b<\/h3>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u7528\u9014\u3054\u3068\u306b\u30c7\u30fc\u30bf\u30a2\u30af\u30bb\u30b9\u30af\u30e9\u30b9\u3092\u4f5c\u3063\u3066\u3044\u304f\u3088\u3046\u306b\u3059\u308b\u3002<\/p>\n<ul>\n<li>\u767a\u6ce8\u30c7\u30fc\u30bf\u30a2\u30af\u30bb\u30b9\u30af\u30e9\u30b9<\/li>\n<li>\u53d7\u6ce8\u30c7\u30fc\u30bf\u30a2\u30af\u30bb\u30b9\u30af\u30e9\u30b9<\/li>\n<\/ul>\n<h3>DBManager\u30af\u30e9\u30b9\u3068\u306e\u9055\u3044\u306f\uff1f<\/h3>\n<p>DBManager\u30af\u30e9\u30b9\u306f\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3068\u306e\u30b3\u30cd\u30af\u30b7\u30e7\u30f3\u3092\u3064\u306a\u3044\u3060\u308a\u3001SQL\u3092\u767a\u884c\u3059\u308b\u3068\u3044\u3046\u30e6\u30fc\u30c6\u30a3\u30ea\u30c6\u30a3\u7684\u306a\u5f79\u5272\u306b\u6bd4\u3079\u308b\u3068\u3001DAO\u306f\u3001<strong>\u3082\u3046\u5c11\u3057\u9ad8\u5ea6\u306a\u30d3\u30b8\u30cd\u30b9\u30ed\u30b8\u30c3\u30af\u306b\u8fd1\u3044\u51e6\u7406\u3092\u884c\u3046\u30af\u30e9\u30b9<\/strong>\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>\u5b9f\u88c5\u6642\u306b\u5fc3\u304c\u3051\u308b\u3053\u3068<\/h3>\n<p>\u76f4\u63a5DAO\u3092new\u3059\u308b\u306e\u3067\u306f\u306a\u304f\u3001DAO\u306e\u30d5\u30a1\u30af\u30c8\u30ea\u30af\u30e9\u30b9\u3001\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3001\u5b9f\u88c5\u30af\u30e9\u30b9\u3092\u7528\u610f\u3057\u3066\u3001<strong>\u300c\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304c\u5909\u308f\u3063\u3066\u3082\u3001\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306f\u5909\u308f\u3089\u306a\u3044\u300d<\/strong>\u3068\u3044\u3063\u305f\u5b9f\u88c5\u306b\u3059\u308b\u3088\u3046\u306b\u5fc3\u304c\u3051\u308b\u3002<\/p>\n<h2>DTO\u3068\u306f\uff1f<\/h2>\n<p>DTO\u306f\u3001\u300cData Transfer Object\u300d\u306e\u7565\u3067\u3001<strong>\u30c7\u30fc\u30bf\u306e\u5165\u308c\u7269\u3068\u3057\u3066\u306e\u30af\u30e9\u30b9\u3092\u4f5c\u6210\u3057\u3066\u3001\u305d\u308c\u306b\u30c7\u30fc\u30bf\u3092\u5165\u308c\u3066\u6e21\u305d\u3046<\/strong>\u3068\u3044\u3046\u30d1\u30bf\u30fc\u30f3\u3067\u3001\u975e\u5e38\u306b\u3088\u304f\u5229\u7528\u3055\u308c\u3066\u3044\u308b\u306e\u3092\u898b\u304b\u3051\u307e\u3059\u3002<\/p>\n<p>JavaBeans\u306e\u6982\u5ff5\u3092\u57fa\u306b\u4f5c\u3089\u308c\u307e\u3057\u305f\u3002<\/p>\n<h3>\u30e1\u30ea\u30c3\u30c8<\/h3>\n<ul>\n<li><span style=\"color: #ff0000;\"><strong>\u308f\u304b\u308a\u3084\u3059\u304f\u4f7f\u3044\u52dd\u624b\u304c\u826f\u3044\u3002<\/strong><\/span><\/li>\n<li>ArrayList\u306a\u3069\u3068\u9055\u3063\u3066\u578b\u306e\u7570\u306a\u308b\u30c7\u30fc\u30bf\u3092\u4e00\u62ec\u3067\u914d\u5217\u3092\u4e00\u62ec\u3067\u7ba1\u7406\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/li>\n<\/ul>\n<h3>\u30c7\u30e1\u30ea\u30c3\u30c8<\/h3>\n<p>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u3068\u3044\u3046\u3088\u308a\u306f\u3001\u624b\u7d9a\u304d\u578b\u306e\u6982\u5ff5\u306b\u8fd1\u3044\u306e\u3067\u3001\u8a2d\u8a08\u4e0a<strong>\u300c\u7f8e\u3057\u304f\u306a\u3044\u300d<\/strong>\u3068\u3044\u308f\u308c\u308b\u3053\u3068\u304c\u3042\u308b\u3002<\/p>\n<h3>\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9<\/h3>\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304b\u3089\u53d6\u5f97\u3057\u305f\u30c7\u30fc\u30bf\u3092\u3053\u308c\u306b\u5165\u308c\u8fbc\u3093\u3067\u5225\u30af\u30e9\u30b9\u306b\u53d7\u3051\u6e21\u3059\u3002<\/p>\n<h3>\u5b9f\u88c5\u4f8b<\/h3>\n<pre class=\"lang:default decode:true\">public class UserDto {\r\n    private int id;\r\n    private String name;\r\n\t\r\n    public int getId() {\r\n\treturn id;\r\n    }\r\n    public void setId(int id) {\r\n\tthis.id = id;\r\n    }\r\n    public String getName() {\r\n\treturn name;\r\n    }\r\n    public void setName(String name) {\r\n\tthis.name = name;\r\n    }\r\n}<\/pre>\n<p>private\u306a\u30d5\u30a3\u30fc\u30eb\u30c9\u3001\u30b2\u30c3\u30bf\u30fc\u3068\u30bb\u30c3\u30bf\u30fc\u3092\u7528\u610f\u3057\u3066\u305d\u308c\u306b\u3088\u3063\u3066\u3053\u306e\u30af\u30e9\u30b9\u306b\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Web\u30a2\u30d7\u30ea\u3067\u3001JDBC\u3092\u5229\u7528\u3057\u305f\u30a2\u30d7\u30ea\u3092\u4f5c\u6210\u3059\u308b\u5834\u5408\u306f\u3001DAO\/DTO\u30d1\u30bf\u30fc\u30f3\u3068\u3044\u3046\u8a2d\u8a08\u304c\u826f\u304f\u4f7f\u308f\u308c\u307e\u3059\u3002 DAO\u3068\u306f\uff1f DAO\u306f\u3001\u300cData Access Object\u300d\u306e\u7565\u3067\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3078\u30a2\u30af\u30bb\u30b9\u3059\u308b\u5c02\u7528\u306e\u30af\u30e9\u30b9 [&hellip;]","protected":false},"author":1,"featured_media":1376,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,21],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/1311"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1311"}],"version-history":[{"count":9,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/1311\/revisions"}],"predecessor-version":[{"id":20248,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/1311\/revisions\/20248"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/media\/1376"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1311"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}