하이버네이트2 3.JPA 시작(2) 간단한 애플리케이션 개발 이전 글에서 작성한 내용을 이어서 보면 된다. public class JpaMain { public static void main(String[] args) { // 엔티티 매니저 팩토리 생성 EntityManagerFactory emf = Persistence.createEntityManagerFactory("jpa_practice"); // 엔티티 매니저 생성 EntityManager em = emf.createEntityManager(); // 트랜잭션 획득 EntityTransaction tx = em.getTransaction(); try { tx.begin(); // 트랜잭션 - 시작 logic(em); // 비지니스 로직 실행 tx.commit(); // 트랜잭션 커.. 2023. 12. 27. 2.JPA 시작(1) 1.H2 데이터베이스 설치 H2 Database Engine H2 Database Engine Welcome to H2, the Java SQL database. The main features of H2 are: Very fast, open source, JDBC API Embedded and server modes; in-memory databases Browser based Console application Small footprint: around 2.5 MB jar file size Supp www.h2database.com 2.예제 테이블 생성 CREATE TABLE MEMBER( ID VARCHAR(255) NOT NULL, -- 아이디(PK) NAME VARCHAR(255), -- 이름 .. 2023. 12. 27. 이전 1 다음