Java147 [JPA_Basic] 프로젝션 - 여러 값 조회 이 글은 김영한의 [자바 ORM 표준 JPA 프로그래밍 - 기본편]을 수강하며 정리한 글입니다. 👉 기본 환경 - Language: Java - DB: H2 Database - IDE: IntelliJ Query: SELECT m.name, m.age FROM Member m 1. Query 타입 조회 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 public class Main { public static void main(String[] args) { EntityManagerFactory emf = Persistence.createEntit.. 2023. 9. 22. [해결 방법] java.lang.IllegalArgumentException 👉 기본 환경 - Language: Java - DB: H2 Database - IDE: IntelliJ ⌨️ 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 public class Main { public static void main(String[] args) { EntityManagerFactory emf = Persistence.createEntityManagerFactory("hello"); EntityManager em = emf.createEntityManager(); EntityTransaction tx = em.getTransaction(); tx.begi.. 2023. 9. 22. [해결 방법] javax.persistence.NonUniqueResultException 👉 기본 환경 - Language: Java - DB: H2 Database - IDE: IntelliJ ⌨️ 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 public class Main { public static void main(String[] args) { EntityManagerFactory emf = Persistence.createEntityManagerFactory("hello"); EntityManager em = emf.createEntityManager(); EntityTransaction tx = em.getTransaction(); tx.begin().. 2023. 9. 22. [해결 방법] javax.persistence.NoResultException 👉 기본 환경 - Language: Java - DB: H2 Database - IDE: IntelliJ ⌨️ 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 public class Main { public static void main(String[] args) { EntityManagerFactory emf = Persistence.createEntityManagerFactory("hello"); EntityManager em = emf.createEntityManager(); EntityTransaction tx = em.getTransaction(); tx.begin().. 2023. 9. 22. [해결 방법] org.h2.jdbc.JdbcSQLSyntaxErrorException 👉 기본 환경 - Language: Java - DB: H2 Database - IDE: IntelliJ ⌨️ 코드 Order Entity 1 2 3 4 5 6 7 8 9 10 11 12 13 14 @Entity public class Order { @Id @GeneratedValue private Long id; private int orderAmount; @Embedded private Address address; @ManyToOne @JoinColumn(name = "PRODUCT_ID") private Product product; } 🖨️오류 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 3.. 2023. 9. 22. [해결 방법] org.hibernate.QueryException 👉 기본 환경 - Language: Java - DB: H2 Database - IDE: IntelliJ ⌨️ 코드 Member Entity 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 @Entity public class Member extends BaseEntity { @Id @GeneratedValue @Column(name = "MEMBER_ID") private Long id; @Column(name = "USERNAME") private String name; @ManyToOne(fetch = FetchType.EAGER) // Member : Team = Many : One @JoinColumn(name = "TEAM_ID") // JoinColum = FK p.. 2023. 9. 20. 이전 1 2 3 4 5 6 7 8 ··· 25 다음