Last active
February 8, 2017 18:25
-
-
Save rdemorais/978fed5c31da9f527eb76f663e79246b to your computer and use it in GitHub Desktop.
JPA Schema generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
persistence.xml | |
<property name="javax.persistence.schema-generation.database.action" value="create"/> | |
<property name="javax.persistence.schema-generation.scripts.action" value="create"/> | |
<property name="javax.persistence.schema-generation.scripts.create-target" value="create.ddl"/> | |
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver"/> | |
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/db"/> | |
Java class | |
import javax.persistence.Persistence; | |
public class CreateSchema { | |
public static void main(String[] args) { | |
Persistence.generateSchema("JpaPersistenceUnit", null); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment