{"id":380,"date":"2017-01-25T22:21:24","date_gmt":"2017-01-25T13:21:24","guid":{"rendered":"http:\/\/www.mukgee.com\/?p=380"},"modified":"2020-12-27T01:24:31","modified_gmt":"2020-12-26T16:24:31","slug":"javajpa%eb%9e%80","status":"publish","type":"post","link":"http:\/\/mukgee.com\/?p=380","title":{"rendered":"[Java]JPA\ub780"},"content":{"rendered":"<p><strong>J<\/strong>ava <strong>P<\/strong>ersistence <strong>A<\/strong>PI<\/p>\n<p>EJB\uc5d0\uc11c \uad6c\ud604 \ub418\uc5c8\ub358 \uc5d4\ud2f0\ud2f0\ube48\uc744 POJO\ucca0\ud559\uc744 \ubc18\uc601\ud558\uc5ec \uad6c\ud604\ud55c \uae30\uc220.<\/p>\n<p>Persistence \ub780 \uc5b4\ud50c\ub9ac\ucf00\uc774\uc158\uc758 \ub370\uc774\ud130\uac00 \ud504\ub85c\uc138\uc2a4(JVM)\ubcf4\ub2e4 \uc624\ub798 \uc9c0\uc18d \ub418\ub294\uac83\uc744 \ub9d0\ud55c\ub2e4.(<a href=\"http:\/\/www.notforme.kr\/archives\/993\" target=\"_blank\" rel=\"noopener noreferrer\">\ucc38\uace0<\/a>)<\/p>\n<p>\uad00\uacc4\ud615 \ub370\uc774\ud130\ubca0\uc774\uc2a4\uc5d0\uc11c \ubc1b\uc740 \ub370\uc774\ud130\ub97c Row\ub2e8\uc704\ub85c \uc624\ube0c\uc81d\ud2b8\uc5d0 \ub9e4\ud551 \uc2dc\ud0a4\ub294 \uac83\uc774 ORM\uc778\ub370 \uc774\ub97c \ud45c\uc900\ud654 \ud588\ub2e4.<\/p>\n<p>\ub300\ud45c\uc801\uc73c\ub85c Hibernate\uac00 \uc788\ub294\ub370,\u00a0Hibernate\uac00 \ub098\uc654\uae30 \ub54c\ubb38\uc5d0 JPA\uc2a4\ud329\uc774 \uc815\uc758\ub41c\uac83\uc778\uc9c0 , JPA\uc5d0\uc758\ud574\uc11c\u00a0Hibernate\uac00 \uad6c\ud604\ub41c\uac83\uc778\uc9c0\ub294 \ube44\ubc00.<\/p>\n<p>\uc18c\uc2a4\ub85c \ud55c\ubc88 \ucc38\uace0\ud574\ubcf4\uc790. Spring Data\u00a0JPA \ub85c \uad6c\ud604\ud55c\uac83\uc774\ub2e4.<\/p>\n<ol>\n<li>Entity \ud074\ub798\uc2a4 \uc0dd\uc131 &#8211; \ud074\ub798\uc2a4 \uc774\ub984\uc774 \ud14c\uc774\ube14 \uc774\ub984<\/li>\n<\/ol>\n<pre class=\"lang:java decode:true\">\/\/import\uad6c\ubb38\uc740 \uc0dd\ub7b5\n\/\/Entity \uc120\uc5b8\n@Entity\npublic class Car {\n\n    @Id \/\/\ud14c\uc774\ube14\uc758 PK\ub97c \uc9c0\uc815\n    private int carNo;\n    @Column\n    private String color;\n    @Column(length=100, nullable=false) \/\/\uceec\ub7fc \uc18d\uc131\n    private String onwer;\n\n    public Car(){}\n\n    public int getCarNo(){\n        return carNo;\n    }\n\n    public void setCarNo(int carNo){\n        this.carNo = carNo;\n    }\n\/\/getter, setter \uc0dd\ub7b5\n\t\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>2.\u00a0CrudRepository\ub97c \uc0c1\uc18d \ubc1b\uc544 \uad6c\ud604<\/p>\n<pre class=\"lang:java decode:true \">import org.springframework.data.repository.CrudRepository; \n\npublic interface CarRepository extends CrudRepository&lt;Article, Integer&gt; { }<\/pre>\n<p>&nbsp;<\/p>\n<p>3.\uc2e4\ud589<\/p>\n<pre class=\"lang:java decode:true\">\/\/\uc124\uc815 \uc0dd\ub7b5\n@Resource \nCarRepository carRepository; \n\n@Test public void test(){\n    Car car = new Car();\n    car.setCarNo(1);\n    car.setColor(\"#ffffff\");\n    car.setOwner(\"Jin\");\n    carRepository.save(car); \n}\n\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\uac04\ub2e8\ud788 \uac1c\ub150\uc801\uc778 \ubd80\ubd84\ub9cc \ucf54\ub4dc\ub85c \uc801\uc5b4\ubcf8 \uac83\uc774\ub2e4. \uc790\uc138\ud55c \ub0b4\uc6a9\uc744 \uc6d0\ud55c\ub2e4\uba74\u00a0<a href=\"http:\/\/jekalmin.tistory.com\/entry\/springdatajpa-%EA%B8%B0%EB%B3%B8-%EC%98%88%EC%A0%9C\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/jekalmin.tistory.com\/entry\/springdatajpa-%EA%B8%B0%EB%B3%B8-%EC%98%88%EC%A0%9C<\/a>\u00a0\ub97c \ucc38\uace0<\/p>\n<p><del>\uc9c4\uc9dc \uc774\ub7f0 \uc124\uc815 \ud558\ub2e4\ubcf4\uba74 \uadf8\ub0e5 PHP\ud558\uace0 \uc2f6\uc744\ub54c\uac00 \ub9ce\ub2e4. Laravel\uc5d0\uc11c\ub294 \uc800\ub7f0\uac70 \uc5c6\uc774 ORM\uac1c\ub150\uc744 \uc798 \uad6c\ud604\ud558\ub294\uac70 \uac19\ub358\ub370.. \uc2dc\uac04 \ub418\uba74 PHP\uc758 ORM\uacfc Java\uc758 ORM\uc744 \ube44\uad50<\/del><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Java Persistence API EJB\uc5d0\uc11c \uad6c\ud604 \ub418\uc5c8\ub358 \uc5d4\ud2f0\ud2f0\ube48\uc744 POJO\ucca0\ud559\uc744 \ubc18\uc601\ud558\uc5ec \uad6c\ud604\ud55c \uae30\uc220. Persistence \ub780 \uc5b4\ud50c\ub9ac\ucf00\uc774\uc158\uc758 \ub370\uc774\ud130\uac00 \ud504\ub85c\uc138\uc2a4(JVM)\ubcf4\ub2e4 \uc624\ub798 \uc9c0\uc18d \ub418\ub294\uac83\uc744 \ub9d0\ud55c\ub2e4.(\ucc38\uace0) \uad00\uacc4\ud615 \ub370\uc774\ud130\ubca0\uc774\uc2a4\uc5d0\uc11c \ubc1b\uc740 \ub370\uc774\ud130\ub97c Row\ub2e8\uc704\ub85c&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[3],"tags":[19,22],"aioseo_notices":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/mukgee.com\/index.php?rest_route=\/wp\/v2\/posts\/380"}],"collection":[{"href":"http:\/\/mukgee.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/mukgee.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/mukgee.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/mukgee.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=380"}],"version-history":[{"count":1,"href":"http:\/\/mukgee.com\/index.php?rest_route=\/wp\/v2\/posts\/380\/revisions"}],"predecessor-version":[{"id":626,"href":"http:\/\/mukgee.com\/index.php?rest_route=\/wp\/v2\/posts\/380\/revisions\/626"}],"wp:attachment":[{"href":"http:\/\/mukgee.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=380"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/mukgee.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=380"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/mukgee.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=380"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}