Mercurial > dive4elements > river
annotate flys-backend/src/main/java/de/intevation/flys/App.java @ 5531:ac48ab9e1715
Datacage: Added connection to SedDB. Use <dc:context connection="seddb"> to use it.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Wed, 03 Apr 2013 12:54:34 +0200 |
parents | 76c75c8b9ee0 |
children |
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; |
3333
76c75c8b9ee0
SedDB: Make access to SedDB configurable over conf.xml and provide access to sessions.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1229
diff
changeset
|
4 import de.intevation.flys.backend.FLYSCredentials; |
1229
8b12b338a3f6
Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
464
diff
changeset
|
5 |
168
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
165
diff
changeset
|
6 import org.hibernate.cfg.Configuration; |
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
165
diff
changeset
|
7 |
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
165
diff
changeset
|
8 import org.hibernate.dialect.resolver.DialectFactory; |
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
165
diff
changeset
|
9 |
464
d37ccb04ab5d
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
199
diff
changeset
|
10 public class App |
165
a69b8494fcac
Created a new empty maven project
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 { |
174
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
169
diff
changeset
|
12 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
|
13 System.out.println("BEGIN;"); |
168
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
165
diff
changeset
|
14 |
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
165
diff
changeset
|
15 String [] setupScript = cfg.generateSchemaCreationScript( |
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
165
diff
changeset
|
16 DialectFactory.constructDialect( |
3333
76c75c8b9ee0
SedDB: Make access to SedDB configurable over conf.xml and provide access to sessions.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1229
diff
changeset
|
17 FLYSCredentials.getDefault().getDialect())); |
168
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
165
diff
changeset
|
18 |
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
165
diff
changeset
|
19 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
|
20 System.out.println(line + ";"); |
168
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
165
diff
changeset
|
21 } |
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
165
diff
changeset
|
22 |
174
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
169
diff
changeset
|
23 System.out.println("COMMIT;"); |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
169
diff
changeset
|
24 } |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
169
diff
changeset
|
25 |
1229
8b12b338a3f6
Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
464
diff
changeset
|
26 public static void main(String [] args) { |
8b12b338a3f6
Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
464
diff
changeset
|
27 dumpSchema(SessionFactoryProvider.createConfiguration()); |
165
a69b8494fcac
Created a new empty maven project
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 } |
a69b8494fcac
Created a new empty maven project
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 } |
168
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
165
diff
changeset
|
30 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |