From c575021f920591d968ba3cf4d75c4c5e5d79bc4c Mon Sep 17 00:00:00 2001 From: dldusgh318 Date: Sun, 26 May 2024 23:07:22 +0900 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20=EC=9E=90=EB=B0=94=20ORM=20?= =?UTF-8?q?=EC=84=B9=EC=85=98=204=EA=B9=8C=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dldusgh318/ex1-hello-jpa/.idea/vcs.xml | 6 ++ .../ex1-hello-jpa/.idea/jarRepositories.xml" | 20 ++++++ .../jpashop/.idea/.gitignore" | 3 + .../jpashop/.idea/compiler.xml" | 13 ++++ .../jpashop/.idea/encodings.xml" | 7 ++ .../jpashop/.idea/jarRepositories.xml" | 20 ++++++ .../jpashop/.idea/misc.xml" | 12 ++++ .../jpashop/.idea/vcs.xml" | 6 ++ .../jpashop/pom.xml" | 48 +++++++++++++ .../main/java/jpabook/jpashop/JpaMain.java" | 30 +++++++++ .../java/jpabook/jpashop/domain/Item.java" | 50 ++++++++++++++ .../java/jpabook/jpashop/domain/Member.java" | 54 +++++++++++++++ .../java/jpabook/jpashop/domain/Order.java" | 58 ++++++++++++++++ .../jpabook/jpashop/domain/OrderItem.java" | 63 ++++++++++++++++++ .../jpabook/jpashop/domain/OrderStatus.java" | 5 ++ .../main/resources/META-INF/persistence.xml" | 22 ++++++ .../jpashop/src/main/resources/logback.xml" | 14 ++++ .../target/classes/META-INF/persistence.xml" | 22 ++++++ .../classes/jpabook/jpashop/JpaMain.class" | Bin 0 -> 1376 bytes .../jpabook/jpashop/domain/Item.class" | Bin 0 -> 1385 bytes .../jpabook/jpashop/domain/Member.class" | Bin 0 -> 1543 bytes .../jpabook/jpashop/domain/Order.class" | Bin 0 -> 1706 bytes .../jpabook/jpashop/domain/OrderItem.class" | Bin 0 -> 1588 bytes .../jpabook/jpashop/domain/OrderStatus.class" | Bin 0 -> 1079 bytes .../jpashop/target/classes/logback.xml" | 14 ++++ .../untitled/.idea/vcs.xml" | 6 ++ .../src/main/java/org/example/Main.java" | 5 ++ 27 files changed, 478 insertions(+) create mode 100644 dldusgh318/ex1-hello-jpa/.idea/vcs.xml create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/jarRepositories.xml" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/jpashop/.idea/.gitignore" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/jpashop/.idea/compiler.xml" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/jpashop/.idea/encodings.xml" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/jpashop/.idea/jarRepositories.xml" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/jpashop/.idea/misc.xml" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/jpashop/.idea/vcs.xml" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/jpashop/pom.xml" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/java/jpabook/jpashop/JpaMain.java" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/java/jpabook/jpashop/domain/Item.java" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/java/jpabook/jpashop/domain/Member.java" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/java/jpabook/jpashop/domain/Order.java" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/java/jpabook/jpashop/domain/OrderItem.java" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/java/jpabook/jpashop/domain/OrderStatus.java" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/resources/META-INF/persistence.xml" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/resources/logback.xml" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/jpashop/target/classes/META-INF/persistence.xml" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/jpashop/target/classes/jpabook/jpashop/JpaMain.class" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/jpashop/target/classes/jpabook/jpashop/domain/Item.class" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/jpashop/target/classes/jpabook/jpashop/domain/Member.class" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/jpashop/target/classes/jpabook/jpashop/domain/Order.class" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/jpashop/target/classes/jpabook/jpashop/domain/OrderItem.class" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/jpashop/target/classes/jpabook/jpashop/domain/OrderStatus.class" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/jpashop/target/classes/logback.xml" create mode 100644 "dldusgh318/\355\206\240\354\235\264\355\224\204\353\241\234\354\240\235\355\212\270/untitled/.idea/vcs.xml" create mode 100644 "dldusgh318/\355\206\240\354\235\264\355\224\204\353\241\234\354\240\235\355\212\270/untitled/src/main/java/org/example/Main.java" diff --git a/dldusgh318/ex1-hello-jpa/.idea/vcs.xml b/dldusgh318/ex1-hello-jpa/.idea/vcs.xml new file mode 100644 index 0000000..b2bdec2 --- /dev/null +++ b/dldusgh318/ex1-hello-jpa/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/jarRepositories.xml" "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/jarRepositories.xml" new file mode 100644 index 0000000..712ab9d --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/jarRepositories.xml" @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/jpashop/.idea/.gitignore" "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/.idea/.gitignore" new file mode 100644 index 0000000..26d3352 --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/.idea/.gitignore" @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/jpashop/.idea/compiler.xml" "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/.idea/compiler.xml" new file mode 100644 index 0000000..ac6c43f --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/.idea/compiler.xml" @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/jpashop/.idea/encodings.xml" "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/.idea/encodings.xml" new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/.idea/encodings.xml" @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/jpashop/.idea/jarRepositories.xml" "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/.idea/jarRepositories.xml" new file mode 100644 index 0000000..712ab9d --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/.idea/jarRepositories.xml" @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/jpashop/.idea/misc.xml" "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/.idea/misc.xml" new file mode 100644 index 0000000..d14a160 --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/.idea/misc.xml" @@ -0,0 +1,12 @@ + + + + + + + + \ No newline at end of file diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/jpashop/.idea/vcs.xml" "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/.idea/vcs.xml" new file mode 100644 index 0000000..c2365ab --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/.idea/vcs.xml" @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/jpashop/pom.xml" "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/pom.xml" new file mode 100644 index 0000000..c854ee9 --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/pom.xml" @@ -0,0 +1,48 @@ + + + 4.0.0 + + jpa-basic + ex1-hello-jpa + 1.0.0 + + + 17 + 17 + UTF-8 + + + + + + org.hibernate + hibernate-core + 6.4.2.Final + + + + javax.xml.bind + jaxb-api + 2.3.1 + + + + + com.h2database + h2 + 2.2.224 + + + + + + + diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/java/jpabook/jpashop/JpaMain.java" "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/java/jpabook/jpashop/JpaMain.java" new file mode 100644 index 0000000..be2b2a2 --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/java/jpabook/jpashop/JpaMain.java" @@ -0,0 +1,30 @@ +package jpabook.jpashop; +import jakarta.persistence.*; +import jpabook.jpashop.domain.Member; +import jpabook.jpashop.domain.Order; + +import java.util.List; + +public class JpaMain { + + public static void main(String[] args) { + + EntityManagerFactory emf = Persistence.createEntityManagerFactory("hello");//설정파일을 읽어옴 + EntityManager em = emf.createEntityManager(); + + EntityTransaction tx = em.getTransaction(); + tx.begin(); + try{ + Order order = em.find(Order.class, 1L); + Member findMember = order.getMember(); + + tx.commit(); + } catch(Exception e) { + tx.rollback(); + } finally { + em.close(); + } + + emf.close(); + } +} diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/java/jpabook/jpashop/domain/Item.java" "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/java/jpabook/jpashop/domain/Item.java" new file mode 100644 index 0000000..c010aa0 --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/java/jpabook/jpashop/domain/Item.java" @@ -0,0 +1,50 @@ +package jpabook.jpashop.domain; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; + +@Entity +public class Item { + + @Id @GeneratedValue + @Column(name="ITEM_ID") + private Long id; + + private String name; + private int price; + private int stockQuantity; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getPrice() { + return price; + } + + public void setPrice(int price) { + this.price = price; + } + + public int getStockQuantity() { + return stockQuantity; + } + + public void setStockQuantity(int stockQuantity) { + this.stockQuantity = stockQuantity; + } +} diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/java/jpabook/jpashop/domain/Member.java" "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/java/jpabook/jpashop/domain/Member.java" new file mode 100644 index 0000000..ece56cf --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/java/jpabook/jpashop/domain/Member.java" @@ -0,0 +1,54 @@ +package jpabook.jpashop.domain; + +import jakarta.persistence.*; + +@Entity +public class Member { + @Id @GeneratedValue + @Column(name = "MEMBER_ID") + private Long id; + private String name; + private String city; + private String street; + private String zipcode; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getStreet() { + return street; + } + + public void setStreet(String street) { + this.street = street; + } + + public String getZipcode() { + return zipcode; + } + + public void setZipcode(String zipcode) { + this.zipcode = zipcode; + } +} diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/java/jpabook/jpashop/domain/Order.java" "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/java/jpabook/jpashop/domain/Order.java" new file mode 100644 index 0000000..bd46991 --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/java/jpabook/jpashop/domain/Order.java" @@ -0,0 +1,58 @@ +package jpabook.jpashop.domain; + +import jakarta.persistence.*; + +import java.time.LocalDateTime; + +@Entity +@Table(name = "ORDERS") +public class Order { + @Id @GeneratedValue + @Column(name = "ORDER_ID") + private Long id; + + @Column(name = "MEMBER_ID") + private Long memberId; + + private Member member; + + public Member getMember() { + return member; + } + + private LocalDateTime orderDate; + @Enumerated(EnumType.STRING) + private OrderStatus status; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getMemberId() { + return memberId; + } + + public void setMemberId(Long memberId) { + this.memberId = memberId; + } + + public LocalDateTime getOrderDate() { + return orderDate; + } + + public void setOrderDate(LocalDateTime orderDate) { + this.orderDate = orderDate; + } + + public OrderStatus getStatus() { + return status; + } + + public void setStatus(OrderStatus status) { + this.status = status; + } +} diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/java/jpabook/jpashop/domain/OrderItem.java" "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/java/jpabook/jpashop/domain/OrderItem.java" new file mode 100644 index 0000000..4b7139d --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/java/jpabook/jpashop/domain/OrderItem.java" @@ -0,0 +1,63 @@ +package jpabook.jpashop.domain; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; + +@Entity +public class OrderItem { + + @Id @GeneratedValue + @Column(name = "ORDER_ITEM_ID") + private Long id; + + @Column(name = "ORDER_ID") + private Long orderId; + + @Column(name = "ITEM_ID") + private Long itemId; + + private int orderPrice; + private int count; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getOrderId() { + return orderId; + } + + public void setOrderId(Long orderId) { + this.orderId = orderId; + } + + public Long getItemId() { + return itemId; + } + + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + public int getOrderPrice() { + return orderPrice; + } + + public void setOrderPrice(int orderPrice) { + this.orderPrice = orderPrice; + } + + public int getCount() { + return count; + } + + public void setCount(int count) { + this.count = count; + } +} diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/java/jpabook/jpashop/domain/OrderStatus.java" "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/java/jpabook/jpashop/domain/OrderStatus.java" new file mode 100644 index 0000000..585e384 --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/java/jpabook/jpashop/domain/OrderStatus.java" @@ -0,0 +1,5 @@ +package jpabook.jpashop.domain; + +public enum OrderStatus { + ORDER,CANCEL +} diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/resources/META-INF/persistence.xml" "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/resources/META-INF/persistence.xml" new file mode 100644 index 0000000..99000b9 --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/resources/META-INF/persistence.xml" @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/resources/logback.xml" "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/resources/logback.xml" new file mode 100644 index 0000000..5b49cce --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/src/main/resources/logback.xml" @@ -0,0 +1,14 @@ + + + + + %d{HH:mm} %-5level %logger{36} - %msg%n + + + + + + + + + diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/jpashop/target/classes/META-INF/persistence.xml" "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/target/classes/META-INF/persistence.xml" new file mode 100644 index 0000000..99000b9 --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/target/classes/META-INF/persistence.xml" @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/jpashop/target/classes/jpabook/jpashop/JpaMain.class" "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/target/classes/jpabook/jpashop/JpaMain.class" new file mode 100644 index 0000000000000000000000000000000000000000..aa87056d39550adaba088b37a9c0b4b95a53080b GIT binary patch literal 1376 zcma)6OIOoS5dNmGKnYMvc@#xJUM&UU0~K4W3YLYo$T@J>xVnwkHYH7Z(xC8*T(eSK z=-wZt&Mh2UkL8iYe7SSyn{V#SO@99R_8q`86ru`QVo85YksFb%e6oZA@yoqhm^qYW{My z4i-vhXl)z9geSFW&WyG^NKksH#UL*dwz4OOOMr*$l;&>qjV z?XoZrRnO-%tPsX(4N-R8LxZtdbsNU(hA0V(PZ!#9-%G+^(Q@R@QN1j^eNndA6EC`^ zun&Z1sr7|3?__k(J@QPs zZK<~E7oA^KL&OZ0`SVs!06b$v*sk)*U?j%y(ihNaYujL}ww1ldRzDBGeLUb*FCJoz zJxrz~V}yOhxb_vj#mpH738m#Tj1YEK&TxyscACJhS;A*bWkc*pwH*W5@cCXc{DbKk z!YM+Sz%10SiE6rx8O#b4dZBJnCVUq=U&ak*orrAEI(y%j z#%lXnVBtfbPhHi}k#2U>3u6K+tqx2iaFYj|$ttOUbke4Ga5K&s%c-XK{AFO#9f}f5}fpz0)`I+bC(k& zewSj5Dc%jPfHUCJz>vg{uli0>q2%!DeN-q)nZ^%;e%Mm4wChL74aue(j$z&1k8gGd zE4=j_$2HHDV+Yd0y)$Oaz&1G0FIsWeEHAhjVN?uH%6W+up78e}6A#LEVmOM`3?WP1pR8!`UdVJj|u LJDyHAOHY8mR)6J$ literal 0 HcmV?d00001 diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/jpashop/target/classes/jpabook/jpashop/domain/Member.class" "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/target/classes/jpabook/jpashop/domain/Member.class" new file mode 100644 index 0000000000000000000000000000000000000000..e0ebafa1c1d845d5efc7744d4e999cd3f76294ac GIT binary patch literal 1543 zcmaKsTTc@~6vxjL+S;<%0_CP4pr9?cMTIAnL=g>1iwT%M_+qB*1P0pOW_N0WpGp&r zi4T4NKa}x*c1wWG)Q6t4bFRNVbGCo}{`yTsFKH)FDH_VsutRCe2r8b-&(dv6@6>(Y zI9E+0DDy&l+UyA$Dp%?`xTyol^LsM+XgeFkRuxZAj zSvFN?bowtD4xzL7@zUMOe=jV@$hq}x?Ns6(T?rg9HkyMmUj zu6N2)fi$XBm+hWH*qk+N-*5Li9^ARwLGAUy@u$N#c)9(Er%=_NI_mLAK1cxZ>-tUE zuFF94xo;dcXBvbH)&C9^Ez+mT9AdEJ<;sn*MWcl?jGYtZq_0xPkdS&5O}um~xj%CR zAUzJ4yjh^{zbdhh>xg6HryR;61UG^Kpu*L29`=t{*OG_h`f%d+f~I<_c^o70zHIWI z3>xqOuGC!a(h{ybh22d2|;;w6eSb|=zU80ZlM zV(TFnaB`sqbb9qCiEmNZA|$(6EoqZFkXji2*Nu6MaS)lXXI zqU|zDzcr-c?lBrF6q{KZrfi0C8jX;~D1YALEz7#lu{&p0Pw!YJH>7@IcZAI-VRS%Q z?Q>QwdAh4O?r1co2!>5zwuD{jsE>CwnxIKWSxdPea91#z4ZK~$6nfQa^RD{bz{#hX z)@X+AL8Iex*K-)HRBuyM_fflGt$9*WHVwyUb;WxrEtm{Tg5o|RUU1vxdQaGn;kZJ! zg%7NWLdlhFuVkHXgD1Z@AL!R8N8FadKn z>@hRINQ3KN;CvV@2CKqmK^+VMqcz2QOM-ufC5sR@PV3oIb&{eD| z5CF7B>)06;sEGAn=WEJ*hA}~X=jmAI5^aRedqAsn)1{5Cl<9|7zb`_{DWt5z&jhG2 zypk3ahtcC$A)`?t^RYrU0R>%|Dj;qLcR7ep* zN&|$brmH^g(9@8s-`8uJiVE3`74nRp#|fE=3fYE`odH6EsY}oce;8i+6Fi0nzQXx6 J*fG6tegiSAN=^U( literal 0 HcmV?d00001 diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/jpashop/target/classes/jpabook/jpashop/domain/OrderItem.class" "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/target/classes/jpabook/jpashop/domain/OrderItem.class" new file mode 100644 index 0000000000000000000000000000000000000000..fb911dbb089e9eb9e0966502b56625af51a45272 GIT binary patch literal 1588 zcmai!T~8B16o%g^{iX$^%7-8V0=6KmsGtTRF$K*gRSc5el5IPIfp(W{wOw(@oa2FjIs4q4AP+ha0g=od0+OyRZS@%Os$?M zU{Z%tO{ZrQb@G5lb!1(2RiiCm+qUCbo^tH2zyuM_EZ4J)bLnLnTLDtj?7(wY`EuR=E|9@IxT94 zYs!}Id!2@K4=n-e1yvzu@!U-{X1DC0xH(54y`7FiNpifyU!pHna zr{^~18>LS_6ugnu*Yv#fyYf9Y+55bOIgUVrW1Qm3afHBK?n)TI6zw#B_voAH;ywi& zwNNlf8wO?>;Jn=o%rU^JV~Ks%Bfn z60N{Pl)3(!{2iIE3?^`$JQv(dbHB%QTML{+Qve^ejkD4B+r?DX8QIMChAkX4K#-kwH1lj2WqGz4| R+1T)pzUhBZdZ?cRe*ux-@{#}m literal 0 HcmV?d00001 diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/jpashop/target/classes/jpabook/jpashop/domain/OrderStatus.class" "b/dldusgh318/\354\236\220\353\260\224ORM/jpashop/target/classes/jpabook/jpashop/domain/OrderStatus.class" new file mode 100644 index 0000000000000000000000000000000000000000..9e9b121dbfee4a987d52767bf4743d4336252699 GIT binary patch literal 1079 zcma)4?@!ZE6g_Y4=vE6GbAn9#!5Fd*q0Xo=*&vWP6O)D|RF@Dxbz2>sT}!%-ze`6V zM5E!ef0XgQQbP?UY)$rZ?>pz-bMHI9et-K3U>naQBp8Z=W3%IVpENp0N8Yj4^M+5HA%m z->U5tk}{25NFmM76$M4C^6^6rBZl>|I@JQG)nAI(@Om_RMz>vSe?071{yVedQ0CQt zG?4lmAGyYm)4i_gv`ydUrJ{PGYYwSw?)py16v2^A^3#UhcgZL|;e@iswHTkckAlX>#7u)D;a3D8MK1F{9~F1krlT*4~h z)+j2{$$#<$@>k4VAoH0bhR5_j6W$4gU&MNZe~v_$m2<3ej@uVt9H00HU#5(5iGqqs zcu$TX6z^DtKp!AgHkQw@^d-EGx4WWC*x=IfB*biHW$utjhzgOizu4Q zNXB*jDQsagqHRaCmG8vL-51XA;1og_JQTw~I>)0^$XwUu8e|d + + + + %d{HH:mm} %-5level %logger{36} - %msg%n + + + + + + + + + diff --git "a/dldusgh318/\355\206\240\354\235\264\355\224\204\353\241\234\354\240\235\355\212\270/untitled/.idea/vcs.xml" "b/dldusgh318/\355\206\240\354\235\264\355\224\204\353\241\234\354\240\235\355\212\270/untitled/.idea/vcs.xml" new file mode 100644 index 0000000..c2365ab --- /dev/null +++ "b/dldusgh318/\355\206\240\354\235\264\355\224\204\353\241\234\354\240\235\355\212\270/untitled/.idea/vcs.xml" @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git "a/dldusgh318/\355\206\240\354\235\264\355\224\204\353\241\234\354\240\235\355\212\270/untitled/src/main/java/org/example/Main.java" "b/dldusgh318/\355\206\240\354\235\264\355\224\204\353\241\234\354\240\235\355\212\270/untitled/src/main/java/org/example/Main.java" new file mode 100644 index 0000000..734365b --- /dev/null +++ "b/dldusgh318/\355\206\240\354\235\264\355\224\204\353\241\234\354\240\235\355\212\270/untitled/src/main/java/org/example/Main.java" @@ -0,0 +1,5 @@ +package org.example;public class Main { + public static void main(String[] args) { + System.out.println("Hello world!"); + } +} \ No newline at end of file From 7f1a843190629068bf699d1e1cff4fe2bb85d69e Mon Sep 17 00:00:00 2001 From: dldusgh318 Date: Sun, 26 May 2024 23:20:21 +0900 Subject: [PATCH 2/5] =?UTF-8?q?feat:=20=EC=9E=90=EB=B0=94=20ORM=20?= =?UTF-8?q?=EC=84=B9=EC=85=98=204=EA=B9=8C=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ex1-hello-jpa/.idea/compiler.xml" | 18 +++ .../ex1-hello-jpa/.idea/encodings.xml" | 7 ++ .../ex1-hello-jpa/.idea/misc.xml" | 12 ++ .../ex1-hello-jpa/.idea/vcs.xml" | 7 ++ .../ex1-hello-jpa/.idea/workspace.xml" | 108 ++++++++++++++++++ .../ex1-hello-jpa/pom.xml" | 48 ++++++++ .../src/main/java/hellojpa/JpaMain.java" | 32 ++++++ .../src/main/java/hellojpa/Member.java" | 41 +++++++ .../src/main/java/hellojpa/RoleType.java" | 5 + .../main/resources/META-INF/persistence.xml" | 22 ++++ .../src/main/resources/logback.xml" | 14 +++ .../target/classes/META-INF/persistence.xml" | 22 ++++ .../target/classes/hellojpa/JpaMain.class" | Bin 0 -> 1562 bytes .../target/classes/hellojpa/Member.class" | Bin 0 -> 1236 bytes .../target/classes/hellojpa/RoleType.class" | Bin 0 -> 1020 bytes .../ex1-hello-jpa/target/classes/logback.xml" | 14 +++ 16 files changed, 350 insertions(+) create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/compiler.xml" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/encodings.xml" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/misc.xml" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/vcs.xml" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/workspace.xml" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/pom.xml" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/src/main/java/hellojpa/JpaMain.java" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/src/main/java/hellojpa/Member.java" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/src/main/java/hellojpa/RoleType.java" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/src/main/resources/META-INF/persistence.xml" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/src/main/resources/logback.xml" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/target/classes/META-INF/persistence.xml" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/target/classes/hellojpa/JpaMain.class" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/target/classes/hellojpa/Member.class" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/target/classes/hellojpa/RoleType.class" create mode 100644 "dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/target/classes/logback.xml" diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/compiler.xml" "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/compiler.xml" new file mode 100644 index 0000000..0ce7f68 --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/compiler.xml" @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/encodings.xml" "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/encodings.xml" new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/encodings.xml" @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/misc.xml" "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/misc.xml" new file mode 100644 index 0000000..a8fc129 --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/misc.xml" @@ -0,0 +1,12 @@ + + + + + + + + \ No newline at end of file diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/vcs.xml" "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/vcs.xml" new file mode 100644 index 0000000..def3818 --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/vcs.xml" @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/workspace.xml" "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/workspace.xml" new file mode 100644 index 0000000..a5e5b19 --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/workspace.xml" @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1716357237799 + + + + \ No newline at end of file diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/pom.xml" "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/pom.xml" new file mode 100644 index 0000000..c854ee9 --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/pom.xml" @@ -0,0 +1,48 @@ + + + 4.0.0 + + jpa-basic + ex1-hello-jpa + 1.0.0 + + + 17 + 17 + UTF-8 + + + + + + org.hibernate + hibernate-core + 6.4.2.Final + + + + javax.xml.bind + jaxb-api + 2.3.1 + + + + + com.h2database + h2 + 2.2.224 + + + + + + + diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/src/main/java/hellojpa/JpaMain.java" "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/src/main/java/hellojpa/JpaMain.java" new file mode 100644 index 0000000..4f68e91 --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/src/main/java/hellojpa/JpaMain.java" @@ -0,0 +1,32 @@ +package hellojpa; + +import jakarta.persistence.*; + +import java.util.List; + +public class JpaMain { + + public static void main(String[] args) { + + EntityManagerFactory emf = Persistence.createEntityManagerFactory("hello");//설정파일을 읽어옴 + EntityManager em = emf.createEntityManager(); + + EntityTransaction tx = em.getTransaction(); + tx.begin(); + try{ + + Member member = new Member(); + member.setUsername("C"); + + em.persist(member); + + tx.commit(); //코드 결과 반영 ㅇㅇ + } catch(Exception e) { + tx.rollback(); + } finally { + em.close(); + } + + emf.close(); + } +} diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/src/main/java/hellojpa/Member.java" "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/src/main/java/hellojpa/Member.java" new file mode 100644 index 0000000..219a752 --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/src/main/java/hellojpa/Member.java" @@ -0,0 +1,41 @@ +package hellojpa; + +import jakarta.persistence.*; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Date; + +@Entity +@TableGenerator( + name = "MEMBER_SEQ_GENERATOR", + table = "MY_SEQUENCES", + pkColumnValue = "MEMBER_SEQ", allocationSize = 1) +public class Member { + + @Id + @GeneratedValue(strategy = GenerationType.TABLE,generator = "MEMBER_SEQ_GENERATOR") + private Long id; + + @Column(name = "name",nullable = false) + private String username; + + public Member(){ + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id=id; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } +} diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/src/main/java/hellojpa/RoleType.java" "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/src/main/java/hellojpa/RoleType.java" new file mode 100644 index 0000000..cbe88f5 --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/src/main/java/hellojpa/RoleType.java" @@ -0,0 +1,5 @@ +package hellojpa; + +public enum RoleType { + GUEST,USER,ADMIN; +} diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/src/main/resources/META-INF/persistence.xml" "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/src/main/resources/META-INF/persistence.xml" new file mode 100644 index 0000000..eda61b0 --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/src/main/resources/META-INF/persistence.xml" @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/src/main/resources/logback.xml" "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/src/main/resources/logback.xml" new file mode 100644 index 0000000..5b49cce --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/src/main/resources/logback.xml" @@ -0,0 +1,14 @@ + + + + + %d{HH:mm} %-5level %logger{36} - %msg%n + + + + + + + + + diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/target/classes/META-INF/persistence.xml" "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/target/classes/META-INF/persistence.xml" new file mode 100644 index 0000000..eda61b0 --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/target/classes/META-INF/persistence.xml" @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/target/classes/hellojpa/JpaMain.class" "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/target/classes/hellojpa/JpaMain.class" new file mode 100644 index 0000000000000000000000000000000000000000..5b8f85a5dcf5adc26e592950bae3fd4a60b666c7 GIT binary patch literal 1562 zcma)6ZBr9h7(Gw2$;Ge&h8G1=zX~qu=|Z+Mb&*hT2rgO!nFP+~=HgpO?LV{`KZ9fUi->Ac3TU<06H$U}#rA(S^DW zYK8UcuJK|)`lcWF@uDD^%WwCgPmtO%^?H~=2K@@Ii=!A2OzrANI*N6nX`+_jicR2| z!bbO9FyTc;$7VT*{rFi~2fAjW745}g^h~grD|Mx};>Ztb#XMdAj6E4OvA(;N8s$igI;!32078CcwK#>2a(t%K_P2!Zo zX%|zrRkQ!Eb^yh0RZYzg6s84(?Z)jkb)jq;RTE`!2FX5rE|4Yr{)LOP$O-yeCjPl) zqChu{V6<0jwr%cnF3w?Ip!R$IL2PG&ih0IP;)08UJ$Bj)8x23U@QW@kSy#%dhb^OU zh27{5!SYkjG;NJ6`kIUDHncAa>-DPk9@&OpR9N81zEA2-QJsB7Q13`;pKCr})^4KGwn^Bt-$9noex9s-H(~^XL}W3;%V`dy9QxzrImvt`$#4QoygqJo zz0UO}?Ju!besPonP!Olj*$-kX?%}mzA=y1)|3}tk1RE%! jj3m|=aSF-5Dds4wD-0=&DT;`~&xoH4<#(nMq8 zgCF2W8P}PaK&>^V$(-BXYp=c5?$2M}e*k!m7o$jED2-$e!$=8CUYZ}wqHQ|u;>r1? zY$}1&E6cIep1@GP&=^4mBWaB0kVQ^l;zHWCd)YOM71=qLo7KZn@+?LQELH`KqK zd?lTxES6eK+ZgzCBpvCQO12uN9Y}^{e5KFr>;Gi1Uj4eOGluK?2W3NGq#a?o>~gkZ zR1S>lS@pQ^6A&rhfygU?wDVELr^2%{sbtE!hi+|4K(9 zM5E!eKg#&ryAopwuTv`7?jnb!rt|%j*;mT3x$6EUQT4u7X7k8Qh}?*MzD!>QSgu z%N^MVpBXlDA@#0n4F=^9U=I6^*C~f1a0kNwvWEM3z!0lAo-^EHSO~iclzT=aj;Kmi zF2|9GL*u_|8lE7_3l?b%xYU?dGC99u$h-b0s&=O4c=rCN*RuO{tK|}sof6fU(mn>g z=C>`kVf7uZ4CJzB^~j5UvuK*x@Ytc`5~kDftl_9nJSk^1XsDI88x*}367tqmri9)q zGpMFN>bLE;4$nDxwMhj&nC%kvBuyJ9Z!hwt0_dcr5hv{mkjn54Ax4z&9J0hW$XcP3 zKk69C@0h)W{*^3-Jbh#0P9lB=>j8fQ5rL{Y%U@vO5{&aB|M8y^qD@$MhJv`KF%yeN zEJ30dQ1a_b=UDnCuEXK3CbvzfGQcC4B4-zRtCKO1=et|WmF(k7okD-{&=$JZn zvx+!gQ0z(7?*nn+Cu#ME(m5WTK@!G_EDS{$kE6m+FR*%sBu{nH8I@|GUQ;p>{Y}z) Ki4DRc*!&0ml*HBm literal 0 HcmV?d00001 diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/target/classes/logback.xml" "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/target/classes/logback.xml" new file mode 100644 index 0000000..5b49cce --- /dev/null +++ "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/target/classes/logback.xml" @@ -0,0 +1,14 @@ + + + + + %d{HH:mm} %-5level %logger{36} - %msg%n + + + + + + + + + From 2dfcaea8b2bae30852a17824d2698083d5e0b7c6 Mon Sep 17 00:00:00 2001 From: dldusgh318 <125371704+dldusgh318@users.noreply.github.com> Date: Sun, 26 May 2024 23:22:02 +0900 Subject: [PATCH 3/5] Delete dldusgh318/ex1-hello-jpa/.idea directory --- dldusgh318/ex1-hello-jpa/.idea/vcs.xml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 dldusgh318/ex1-hello-jpa/.idea/vcs.xml diff --git a/dldusgh318/ex1-hello-jpa/.idea/vcs.xml b/dldusgh318/ex1-hello-jpa/.idea/vcs.xml deleted file mode 100644 index b2bdec2..0000000 --- a/dldusgh318/ex1-hello-jpa/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From f1be6a695991d9084a3dae9e6823087f3ddc3e78 Mon Sep 17 00:00:00 2001 From: dldusgh318 <125371704+dldusgh318@users.noreply.github.com> Date: Sun, 26 May 2024 23:22:30 +0900 Subject: [PATCH 4/5] =?UTF-8?q?Delete=20dldusgh318/=ED=86=A0=EC=9D=B4?= =?UTF-8?q?=ED=94=84=EB=A1=9C=EC=A0=9D=ED=8A=B8/untitled=20directory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../untitled/.idea/vcs.xml" | 6 ------ .../untitled/src/main/java/org/example/Main.java" | 5 ----- 2 files changed, 11 deletions(-) delete mode 100644 "dldusgh318/\355\206\240\354\235\264\355\224\204\353\241\234\354\240\235\355\212\270/untitled/.idea/vcs.xml" delete mode 100644 "dldusgh318/\355\206\240\354\235\264\355\224\204\353\241\234\354\240\235\355\212\270/untitled/src/main/java/org/example/Main.java" diff --git "a/dldusgh318/\355\206\240\354\235\264\355\224\204\353\241\234\354\240\235\355\212\270/untitled/.idea/vcs.xml" "b/dldusgh318/\355\206\240\354\235\264\355\224\204\353\241\234\354\240\235\355\212\270/untitled/.idea/vcs.xml" deleted file mode 100644 index c2365ab..0000000 --- "a/dldusgh318/\355\206\240\354\235\264\355\224\204\353\241\234\354\240\235\355\212\270/untitled/.idea/vcs.xml" +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git "a/dldusgh318/\355\206\240\354\235\264\355\224\204\353\241\234\354\240\235\355\212\270/untitled/src/main/java/org/example/Main.java" "b/dldusgh318/\355\206\240\354\235\264\355\224\204\353\241\234\354\240\235\355\212\270/untitled/src/main/java/org/example/Main.java" deleted file mode 100644 index 734365b..0000000 --- "a/dldusgh318/\355\206\240\354\235\264\355\224\204\353\241\234\354\240\235\355\212\270/untitled/src/main/java/org/example/Main.java" +++ /dev/null @@ -1,5 +0,0 @@ -package org.example;public class Main { - public static void main(String[] args) { - System.out.println("Hello world!"); - } -} \ No newline at end of file From b9cf14fa784baaf8d266a6acfc0060cf474a9922 Mon Sep 17 00:00:00 2001 From: dldusgh318 Date: Mon, 27 May 2024 14:37:26 +0900 Subject: [PATCH 5/5] =?UTF-8?q?feat:=20=EC=9B=8C=ED=81=AC=EB=B6=817?= =?UTF-8?q?=EC=A3=BC=EC=B0=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/umc/spring/domain/FoodCategory.java" | 21 ++++++ .../main/java/umc/spring/domain/Member.java" | 67 +++++++++++++++++++ .../main/java/umc/spring/domain/Mission.java" | 33 +++++++++ .../main/java/umc/spring/domain/Region.java" | 25 +++++++ .../main/java/umc/spring/domain/Review.java" | 29 ++++++++ .../java/umc/spring/domain/ReviewImage.java" | 21 ++++++ .../main/java/umc/spring/domain/Store.java" | 33 +++++++++ .../main/java/umc/spring/domain/Terms.java" | 29 ++++++++ .../umc/spring/domain/common/BaseEntity.java" | 20 ++++++ .../java/umc/spring/domain/enums/Gender.java" | 5 ++ .../spring/domain/enums/MemberStatus.java" | 5 ++ .../umc/spring/domain/enums/SocialType.java" | 5 ++ .../spring/domain/mapping/MemberAgree.java" | 25 +++++++ .../spring/domain/mapping/MemberMission.java" | 28 ++++++++ .../spring/domain/mapping/MemberPrefer.java" | 27 ++++++++ .../spring/domain/mapping/MissionStatus.java" | 5 ++ .../src/main/resources/application.yml" | 24 +++++++ .../ex1-hello-jpa/.idea/workspace.xml" | 22 +++--- 18 files changed, 413 insertions(+), 11 deletions(-) create mode 100644 "dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/FoodCategory.java" create mode 100644 "dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/Member.java" create mode 100644 "dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/Mission.java" create mode 100644 "dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/Region.java" create mode 100644 "dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/Review.java" create mode 100644 "dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/ReviewImage.java" create mode 100644 "dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/Store.java" create mode 100644 "dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/Terms.java" create mode 100644 "dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/common/BaseEntity.java" create mode 100644 "dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/enums/Gender.java" create mode 100644 "dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/enums/MemberStatus.java" create mode 100644 "dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/enums/SocialType.java" create mode 100644 "dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/mapping/MemberAgree.java" create mode 100644 "dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/mapping/MemberMission.java" create mode 100644 "dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/mapping/MemberPrefer.java" create mode 100644 "dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/mapping/MissionStatus.java" create mode 100644 "dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/resources/application.yml" diff --git "a/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/FoodCategory.java" "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/FoodCategory.java" new file mode 100644 index 0000000..72e531e --- /dev/null +++ "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/FoodCategory.java" @@ -0,0 +1,21 @@ +package umc.spring.domain; + +import jakarta.persistence.*; +import lombok.*; + +@Entity +@Getter +@Builder +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor +public class FoodCategory { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column(nullable = false,length = 15) + private String name; + + +} diff --git "a/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/Member.java" "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/Member.java" new file mode 100644 index 0000000..b9db766 --- /dev/null +++ "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/Member.java" @@ -0,0 +1,67 @@ +package umc.spring.domain; + +import jakarta.persistence.*; +import lombok.*; +import umc.spring.domain.common.BaseEntity; +import umc.spring.domain.enums.Gender; +import umc.spring.domain.enums.MemberStatus; +import umc.spring.domain.enums.SocialType; +import umc.spring.domain.mapping.MemberAgree; +import umc.spring.domain.mapping.MemberMission; +import umc.spring.domain.mapping.MemberPrefer; + +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.List; + +@Entity +@Getter +@Builder +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor +public class Member extends BaseEntity { + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column(nullable = false,length = 20) + private String name; + + private Integer age; + + @Column(nullable = false,length = 40) + private String address; + + @Column(nullable = false,length = 40) + private String specAddress; + + @Enumerated(EnumType.STRING) + @Column(columnDefinition = "VARCHAR(10)") + private Gender gender; + + @Enumerated(EnumType.STRING) + private SocialType socialType; + + @Enumerated(EnumType.STRING) + @Column(columnDefinition = "VARCHAR(15) DEFAULT 'ACTIVE'") + private MemberStatus memberStatus; + + private LocalDate inactiveDate; + + @Column(nullable = false, length = 50) + private String email; + + private Integer point; + + @OneToMany(mappedBy = "member", cascade = CascadeType.ALL) + private List memberAgreeList = new ArrayList<>(); + + @OneToMany(mappedBy = "member", cascade = CascadeType.ALL) + private List memberPreferList = new ArrayList<>(); + + @OneToMany(mappedBy = "member", cascade = CascadeType.ALL) + private List reviewList = new ArrayList<>(); + + @OneToMany(mappedBy = "member", cascade = CascadeType.ALL) + private List memberMissionList = new ArrayList<>(); + +} diff --git "a/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/Mission.java" "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/Mission.java" new file mode 100644 index 0000000..10f9c32 --- /dev/null +++ "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/Mission.java" @@ -0,0 +1,33 @@ +package umc.spring.domain; + +import jakarta.persistence.*; +import umc.spring.domain.common.BaseEntity; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +import lombok.*; +import umc.spring.domain.mapping.MemberMission; + +@Entity +@Getter +@Builder +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor +public class Mission extends BaseEntity { + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private Integer reward; + + private LocalDateTime deadline; + + private String mission_spec; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "store_id") + private Store store; + + @OneToMany(mappedBy = "mission", cascade = CascadeType.ALL) + private List memberMissionList = new ArrayList<>(); +} diff --git "a/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/Region.java" "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/Region.java" new file mode 100644 index 0000000..fc679ef --- /dev/null +++ "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/Region.java" @@ -0,0 +1,25 @@ +package umc.spring.domain; + +import jakarta.persistence.*; +import umc.spring.domain.common.BaseEntity; +import lombok.*; + +import java.util.ArrayList; +import java.util.List; + +@Entity +@Getter +@Builder +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor +public class Region extends BaseEntity { + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column(nullable = false,length = 20) + private String name; + + @OneToMany(mappedBy = "region",cascade = CascadeType.ALL) + private List storeList=new ArrayList<>(); + +} diff --git "a/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/Review.java" "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/Review.java" new file mode 100644 index 0000000..dfe8693 --- /dev/null +++ "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/Review.java" @@ -0,0 +1,29 @@ +package umc.spring.domain; + + +import jakarta.persistence.*; +import umc.spring.domain.common.BaseEntity; +import lombok.*; + +@Entity +@Getter +@Builder +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor +public class Review extends BaseEntity { + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private String body; + + private Float score; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "store_id") + private Store store; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "member_id") + private Member member; + +} diff --git "a/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/ReviewImage.java" "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/ReviewImage.java" new file mode 100644 index 0000000..2b4abfe --- /dev/null +++ "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/ReviewImage.java" @@ -0,0 +1,21 @@ +package umc.spring.domain; + +import jakarta.persistence.*; +import lombok.*; +import umc.spring.domain.common.BaseEntity; + +@Entity +@Getter +@Builder +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor +public class ReviewImage extends BaseEntity { + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private String image_url; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "review_id") + private Review review; +} diff --git "a/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/Store.java" "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/Store.java" new file mode 100644 index 0000000..618485a --- /dev/null +++ "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/Store.java" @@ -0,0 +1,33 @@ +package umc.spring.domain; + +import jakarta.persistence.*; +import umc.spring.domain.common.BaseEntity; +import lombok.*; + +import java.util.ArrayList; +import java.util.List; + +@Entity +@Getter +@Builder +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor +public class Store extends BaseEntity { + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column(nullable = false,length = 50) + private String name; + + @Column(nullable = false,length = 50) + private String address; + + private Float score; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "region_id") + private Region region; + + @OneToMany(mappedBy = "store",cascade = CascadeType.ALL) + private List reviewList=new ArrayList<>(); +} diff --git "a/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/Terms.java" "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/Terms.java" new file mode 100644 index 0000000..633e54d --- /dev/null +++ "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/Terms.java" @@ -0,0 +1,29 @@ +package umc.spring.domain; + +import jakarta.persistence.*; +import umc.spring.domain.common.BaseEntity; +import lombok.*; +import umc.spring.domain.mapping.MemberAgree; + +import java.util.ArrayList; +import java.util.List; + +@Entity +@Getter +@Builder +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor +public class Terms extends BaseEntity { + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column(nullable = false,length = 20) + private String title; + + private String body; + + private Boolean optional; + + @OneToMany(mappedBy = "terms", cascade = CascadeType.ALL) + private List memberAgreeList = new ArrayList<>(); +} diff --git "a/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/common/BaseEntity.java" "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/common/BaseEntity.java" new file mode 100644 index 0000000..7abfac2 --- /dev/null +++ "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/common/BaseEntity.java" @@ -0,0 +1,20 @@ +package umc.spring.domain.common; + +import jakarta.persistence.EntityListeners; +import jakarta.persistence.MappedSuperclass; +import lombok.Getter; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.annotation.LastModifiedDate; + +import java.time.LocalDateTime; + +@MappedSuperclass +@EntityListeners(AbstractMethodError.class) +@Getter +public abstract class BaseEntity { + @CreatedDate + private LocalDateTime createdAt; + + @LastModifiedDate + private LocalDateTime updatedAt; +} diff --git "a/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/enums/Gender.java" "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/enums/Gender.java" new file mode 100644 index 0000000..5d1bd65 --- /dev/null +++ "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/enums/Gender.java" @@ -0,0 +1,5 @@ +package umc.spring.domain.enums; + +public enum Gender { + MALE,FEMALE +} diff --git "a/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/enums/MemberStatus.java" "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/enums/MemberStatus.java" new file mode 100644 index 0000000..48d84ba --- /dev/null +++ "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/enums/MemberStatus.java" @@ -0,0 +1,5 @@ +package umc.spring.domain.enums; + +public enum MemberStatus { + ACTIVE,INACTIVE +} diff --git "a/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/enums/SocialType.java" "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/enums/SocialType.java" new file mode 100644 index 0000000..6206309 --- /dev/null +++ "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/enums/SocialType.java" @@ -0,0 +1,5 @@ +package umc.spring.domain.enums; + +public enum SocialType { + KAKAO,GOOGLE,NAVER,APPLE +} diff --git "a/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/mapping/MemberAgree.java" "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/mapping/MemberAgree.java" new file mode 100644 index 0000000..0842fe1 --- /dev/null +++ "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/mapping/MemberAgree.java" @@ -0,0 +1,25 @@ +package umc.spring.domain.mapping; + +import jakarta.persistence.*; +import umc.spring.domain.Member; +import umc.spring.domain.Terms; +import umc.spring.domain.common.BaseEntity; +import lombok.*; + +@Entity +@Getter +@Builder +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor +public class MemberAgree extends BaseEntity { + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @ManyToOne(fetch =FetchType.LAZY) + @JoinColumn(name = "member_id") + private Member member; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name="terms_id") + private Terms terms; +} diff --git "a/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/mapping/MemberMission.java" "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/mapping/MemberMission.java" new file mode 100644 index 0000000..83e2875 --- /dev/null +++ "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/mapping/MemberMission.java" @@ -0,0 +1,28 @@ +package umc.spring.domain.mapping; + +import jakarta.persistence.*; +import lombok.*; +import umc.spring.domain.Member; +import umc.spring.domain.Mission; +import umc.spring.domain.common.BaseEntity; + +@Entity +@Getter +@Builder +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor +public class MemberMission extends BaseEntity { + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Enumerated(EnumType.STRING) + private MissionStatus status; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "member_id") + private Member member; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "mission_id") + private Mission mission; +} diff --git "a/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/mapping/MemberPrefer.java" "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/mapping/MemberPrefer.java" new file mode 100644 index 0000000..01ca650 --- /dev/null +++ "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/mapping/MemberPrefer.java" @@ -0,0 +1,27 @@ +package umc.spring.domain.mapping; + +import jakarta.persistence.*; +import lombok.*; +import umc.spring.domain.FoodCategory; +import umc.spring.domain.Member; +import umc.spring.domain.common.BaseEntity; + +@Entity +@Getter +@Builder +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor +public class MemberPrefer extends BaseEntity { + + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @ManyToOne(fetch= FetchType.LAZY) //지연로딩 설정 + @JoinColumn(name = "member_id") + private Member member; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "category_id") + private FoodCategory foodCategory; + +} diff --git "a/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/mapping/MissionStatus.java" "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/mapping/MissionStatus.java" new file mode 100644 index 0000000..f090fb4 --- /dev/null +++ "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/java/umc/spring/domain/mapping/MissionStatus.java" @@ -0,0 +1,5 @@ +package umc.spring.domain.mapping; + +public enum MissionStatus { + CHALLENGING, COMPLETE +} diff --git "a/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/resources/application.yml" "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/resources/application.yml" new file mode 100644 index 0000000..d98554d --- /dev/null +++ "b/dldusgh318/\354\233\214\355\201\254\353\266\201/spring/spring/src/main/resources/application.yml" @@ -0,0 +1,24 @@ +spring: + datasource: + url: jdbc:h2:tcp://localhost/~/umcspring + username: sa + password: + driver-class-name: org.h2.Driver + + jpa: + hibernate: + ddl-auto: update + properties: + hibernate: + format_sql: true + dialect: org.hibernate.dialect.H2Dialect +# show_sql: true +# use_sql_comments: true +# hbm2ddl: +# auto: create + default_batch_fetch_size: 1000 + +logging: + level: + org.hibernate.SQL: debug + org.hibernate.orm.jdbc.bind: trace \ No newline at end of file diff --git "a/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/workspace.xml" "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/workspace.xml" index a5e5b19..06eaaf2 100644 --- "a/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/workspace.xml" +++ "b/dldusgh318/\354\236\220\353\260\224ORM/ex1-hello-jpa/.idea/workspace.xml" @@ -4,7 +4,7 @@