annotate flys-backend/src/main/java/de/intevation/flys/App.java @ 2798:5a654f2e35bc

Added a python tool to import shapefiles into database. flys-backend/trunk@4127 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 07 Mar 2012 20:37:03 +0000
parents 8b12b338a3f6
children 76c75c8b9ee0
rev   line source
165
a69b8494fcac Created a new empty maven project
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.flys;
a69b8494fcac Created a new empty maven project
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
1229
8b12b338a3f6 Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 464
diff changeset
3 import de.intevation.flys.backend.SessionFactoryProvider;
8b12b338a3f6 Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 464
diff changeset
4
168
86a1bd9cc50e More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 165
diff changeset
5 import org.hibernate.cfg.Configuration;
86a1bd9cc50e More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 165
diff changeset
6
86a1bd9cc50e More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 165
diff changeset
7 import org.hibernate.dialect.resolver.DialectFactory;
86a1bd9cc50e More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 165
diff changeset
8
464
d37ccb04ab5d Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 199
diff changeset
9 public class App
165
a69b8494fcac Created a new empty maven project
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10 {
174
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 169
diff changeset
11 public static void dumpSchema(Configuration cfg) {
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 169
diff changeset
12 System.out.println("BEGIN;");
168
86a1bd9cc50e More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 165
diff changeset
13
86a1bd9cc50e More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 165
diff changeset
14 String [] setupScript = cfg.generateSchemaCreationScript(
86a1bd9cc50e More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 165
diff changeset
15 DialectFactory.constructDialect(
1229
8b12b338a3f6 Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 464
diff changeset
16 SessionFactoryProvider.DEFAULT_DIALECT));
168
86a1bd9cc50e More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 165
diff changeset
17
86a1bd9cc50e More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 165
diff changeset
18 for (String line: setupScript) {
174
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 169
diff changeset
19 System.out.println(line + ";");
168
86a1bd9cc50e More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 165
diff changeset
20 }
86a1bd9cc50e More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 165
diff changeset
21
174
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 169
diff changeset
22 System.out.println("COMMIT;");
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 169
diff changeset
23 }
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 169
diff changeset
24
1229
8b12b338a3f6 Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 464
diff changeset
25 public static void main(String [] args) {
8b12b338a3f6 Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 464
diff changeset
26 dumpSchema(SessionFactoryProvider.createConfiguration());
165
a69b8494fcac Created a new empty maven project
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27 }
a69b8494fcac Created a new empty maven project
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
28 }
168
86a1bd9cc50e More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 165
diff changeset
29 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org