문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
java:jpa:schema_generation [2012/08/19 12:24] kwon37xi [Java 코드를 통한 DDL 생성] |
java:jpa:schema_generation [2015/09/20 13:41] (현재) kwon37xi [읽어보기] |
||
---|---|---|---|
줄 3: | 줄 3: | ||
* '' | * '' | ||
* persistence.xml에 **hibernate.dialect** 가 잘 정의돼 있어야 한다. | * persistence.xml에 **hibernate.dialect** 가 잘 정의돼 있어야 한다. | ||
+ | * '' | ||
+ | |||
+ | ===== Gradle ===== | ||
+ | * [[http:// | ||
+ | |||
+ | ===== JPA 2.1 ===== | ||
+ | * [[http:// | ||
+ | |||
===== Java 코드를 통한 DDL 생성 ===== | ===== Java 코드를 통한 DDL 생성 ===== | ||
+ | * [[http:// | ||
<code java> | <code java> | ||
import java.util.HashMap; | import java.util.HashMap; | ||
줄 13: | 줄 22: | ||
public class JPASchemaExport { | public class JPASchemaExport { | ||
public static void main(String[] args) { | public static void main(String[] args) { | ||
+ | String persistenceUnitName = args[0]; | ||
+ | String outputFile = args[1]; | ||
+ | |||
Ejb3Configuration cfg = new Ejb3Configuration(); | Ejb3Configuration cfg = new Ejb3Configuration(); | ||
HashMap< | HashMap< | ||
- | props.put(" | + | Ejb3Configuration configured = cfg.configure(persistenceUnitName, props); |
- | Ejb3Configuration configured = cfg.configure(" | + | |
SchemaExport se = new SchemaExport(configured.getHibernateConfiguration()); | SchemaExport se = new SchemaExport(configured.getHibernateConfiguration()); | ||
+ | se.setOutputFile(outputFile); | ||
+ | se.setFormat(true|false); | ||
se.setDelimiter(";" | se.setDelimiter(";" | ||
se.create(true, | se.create(true, | ||
줄 84: | 줄 97: | ||
* **''< | * **''< | ||
* **''< | * **''< | ||
+ | |||
+ | ===== 읽어보기 ===== | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// |