JPA 설정 파일 - /META-INF/persistence.xml 생성
* persistence-unit name으로 이름 지정
* javax.persistence로 시작되는 property : JPA 표준 속성
* hibernate로 시작되는 property : Hibernate 전용 속성
persistence.xml 예)
<?xml version="1.0" encoding="UTF-8"?><persistence version="2.2"xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd"><persistence-unit name="hello">
<properties>
<!-- 필수 속성 -->
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/><property name="javax.persistence.jdbc.user" value="sa"/><property name="javax.persistence.jdbc.password" value=""/><property name="javax.persistence.jdbc.url" value="jdbc:h2:tcp://localhost/~/test"/><property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/><!-- 옵션 --><property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/><property name="hibernate.use_sql_comments" value="true"/>
<!--<property name="hibernate.hbm2ddl.auto" value="create" />-->
</properties>
</persistence-unit>
</persistence>
'JPA' 카테고리의 다른 글
(JPA, DB) 테이블 설계 시 주의사항 (0) | 2023.01.15 |
---|---|
(JPA) 연관관계 매핑 예시 (0) | 2023.01.15 |
(JPA) 연관관계 주인 정하는 기준 (0) | 2023.01.15 |
(JPA) 테이블 설계 및 주의사항 (0) | 2023.01.15 |
(JPA) JPA 구동 방식 (0) | 2023.01.08 |