Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • spring.jpa.hibernate.naming.strategy=org.hibernate.cfg.EJB3NamingStrategy
  • spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl


방언설정

No Format
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect

각각의 DB에따라 약간식 틀린 SQL문을 방언이라고하며 , JPA에서는 특수한 DB를 사용했을시

방언지정을 통해  소스변경없이 작동되도록 지원합니다.


Expand
title방언표

Database 방언(Dialect)

방언이란 서로 다른 Database간의 SQL문법 차이를 말하며 JPA 구현체들은 이를 보정해 주기 위해 Dialect Class를 제공한다 이를 통해서 Database가 변경되어도 Dialect Class교체 만으로 코드 변경없이 문제를 해결 할 수 있게 된다.

Hibernate 의 Dialect 리스트는 아래 와 같다.

Name설명
Cache71DialectCaché 2007.1 dialect.
DataDirectOracle9Dialect 
DB2390DialectAn SQL dialect for DB2/390.
DB2400DialectAn SQL dialect for DB2/400.
DB2DialectAn SQL dialect for DB2.
DerbyDialectHibernate Dialect for Cloudscape 10 - aka Derby.
DialectRepresents a dialect of SQL implemented by a particular RDBMS.
FirebirdDialectAn SQL dialect for Firebird.
FrontBaseDialectAn SQL Dialect for Frontbase.
H2DialectA dialect compatible with the H2 database.
HSQLDialectAn SQL dialect compatible with HSQLDB (HyperSQL). HSQLDialect.ReadUncommittedLockingStrategy
InformixDialectInformix dialect. Seems to work with Informix Dynamic Server Version 7.31.UD3, Informix JDBC driver version 2.21JC3.
Ingres10DialectA SQL dialect for Ingres 10 and later versions.
Ingres9DialectA SQL dialect for Ingres 9.3 and later versions.
IngresDialectAn SQL dialect for Ingres 9.2.
InterbaseDialectAn SQL dialect for Interbase.
JDataStoreDialectA Dialect for JDataStore.
MckoiDialectAn SQL dialect compatible with McKoi SQL.
MimerSQLDialectAn Hibernate 3 SQL dialect for Mimer SQL.
MySQL5DialectAn SQL dialect for MySQL 5.x specific features.
MySQL5InnoDBDialect MySQLDialectAn SQL dialect for MySQL (prior to 5.x).
MySQLInnoDBDialect 
MySQLMyISAMDialect 
Oracle10gDialectA dialect specifically for use with Oracle 10g.
Oracle8iDialectA dialect for Oracle 8i.
Oracle9DialectDeprecated. Use either Oracle9iDialect or Oracle10gDialect instead
Oracle9iDialectA dialect for Oracle 9i databases.
OracleDialectDeprecated. Use Oracle8iDialect instead.
PointbaseDialectA Dialect for Pointbase.
PostgresPlusDialectAn SQL dialect for Postgres Plus
PostgreSQLDialectAn SQL dialect for Postgres For discussion of BLOB “support” in postrges, as of 8.4, have a peek at http://jdbc.postgresql.org/documentation/84/binary-data.html.
ProgressDialectAn SQL dialect compatible with Progress 9.1C Connection Parameters required: hibernate.dialect org.hibernate.sql.ProgressDialect hibernate.driver com.progress.sql.jdbc.JdbcProgressDriver hibernate.url jdbc:JdbcProgress:T:host:port:dbname;WorkArounds=536870912 hibernate.username username hibernate.password password The WorkArounds parameter in the URL is required to avoid an error in the Progress 9.1C JDBC driver related to PreparedStatements.
RDMSOS2200DialectThis is the Hibernate dialect for the Unisys 2200 Relational Database (RDMS).
ResultColumnReferenceStrategyDefines how we need to reference columns in the group-by, having, and order-by clauses.
SAPDBDialectAn SQL dialect compatible with SAP DB.
SQLServer2008DialectA dialect for Microsoft SQL Server 2008 with JDBC Driver 3.0 and above
SQLServerDialectA dialect for Microsoft SQL Server 2000 and 2005
Sybase11DialectA SQL dialect suitable for use with Sybase 11.9.2 (specifically: avoids ANSI JOIN syntax)
SybaseAnywhereDialectSQL Dialect for Sybase Anywhere extending Sybase (Enterprise) Dialect (Tested on ASA 8.x)
SybaseASE15DialectAn SQL dialect targetting Sybase Adaptive Server Enterprise (ASE) 15 and higher.
SybaseDialectDeprecated. use AbstractTransactSQLDialect, SybaseASE15Dialect or SQLServerDialect instead depending on need.
TeradataDialectA dialect for the Teradata database created by MCR as part of the dialect certification process.
TimesTenDialectA SQL dialect for TimesTen 5.1.



Data Model(Entity) 생성

Code Block
languagejava
themeEmacs
titleUser Entity
package com.psmon.springdb;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

@Entity // This tells Hibernate to make a table out of this class
public class User {
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Integer id;
	
	private String name;
	
	private String email;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

}

...