Last active
June 4, 2021 12:57
-
-
Save entrofi/47de130941a92665a708ce4f9b25ab38 to your computer and use it in GitHub Desktop.
JPA Export DDL
This file contains hidden or 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
@Bean(name = JPA_PROPERTIES_BEAN_NAME) | |
public Properties jpaPropertiesUnitTest() { | |
Properties properties = new Properties(); | |
properties.put(PROPERTY_HIBERNATE_DIALECT, "org.hibernate.dialect.H2Dialect"); | |
properties.put(PROPERTY_HIBERNATE_SHOW_SQL, true); | |
properties.put(PROPERTY_HIBERNATE_FROMAT_SQL, true); | |
properties.put(PROPERTY_HIBERNATE_DDL, VALUE_HIBERNATE_DDL_UPDATE); | |
properties.put(PROPERTY_HIBERNATE_NAMING_STRATEGY, VALUE_HIBERNATE_DEFAULT_NAMING_STRATEGY); | |
properties.put(PROPERTY_HIBERNATE_CONNECTION_CHARSET, DEFAULT_CHARSET); | |
properties.put(PROPERTY_HIBERNATE_LAZY_LOAD, true); | |
//Export DDL | |
properties.put("javax.persistence.schema-generation.scripts.action", "drop-and-create"); | |
properties.put("javax.persistence.schema-generation.scripts.create-target", "tiger-schema-create.jpa.ddl"); | |
properties.put("javax.persistence.schema-generation.scripts.drop-target","tiger-schema-drop.jpa.ddl"); | |
return properties; | |
} |
This file contains hidden or 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
spring.jpa.properties.javax.persistence.schema-generation.scripts.action=drop-and-create | |
spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=postgre-schema-create.jpa.ddl | |
spring.jpa.properties.javax.persistence.schema-generation.scripts.drop-target=postgre-schema-drop.jpa.ddl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment