본문 바로가기

명사 美 비격식 (무리 중에서) 아주 뛰어난[눈에 띄는] 사람[것]

JAVA/JPA

hibernate.dialect, hiberbate란?

JPA를 사용하기 위해서는 구현체가 필요하다.

그중 대표적인것이 hiberbate.

비슷한 예로는 spring에서 spring data jpa모듈이 되겠다.

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" 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_1.xsd">
	
	<!-- JPA 메인환결설정파일 -->
	
	<!-- 연결하려는 데이터베이스가 여러개면 <persistence-unit>를 여러개 설정한다. -->
	<persistence-unit name="JPA">
		<class>com.himedia.domain.Board</class>
		
		<properties>
			<!-- 필수 속성, 데이터설정 -->
			<!-- JPA hibernate.dialect를 통해 데이터베이스에 따른 SQL를 생성. -->
			<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="1234" />
			<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="false" />
			<property name="hibernate.id.new_generator_mappings" value="true" />
			
			<!-- ddl구문을 자동으로 실행하지에대한 여부 -->
			<!-- <property name="hibernate.hbm2ddl.auto" value="create" /> -->
			<property name="hibernate.hbm2ddl.auto" value="update" />
			
		</properties>
	</persistence-unit>
	
</persistence>

 

 

 

https://standout.tistory.com/563

 

JPA란?

JPA (Java Persistence API) ORM기술의 표준. 개발자가 객체지향적 프로그래밍에 집중할 수 있도록 JPA가 관계형 데이터베이스에 맞게 SQL을 대신 생성/실행하여 도와줌.

standout.tistory.com

 

'JAVA > JPA' 카테고리의 다른 글

Annotation - @Id  (0) 2023.06.25
Annotation - @Table  (0) 2023.06.25
Annotation - @Entity  (0) 2023.06.25
JPA 테이블 생성 및 db추가  (0) 2023.05.03
JPA 테이블 CRUD중 에러, java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException  (0) 2023.05.03