Mercurial > dive4elements > river
diff flys-backend/src/main/java/de/intevation/flys/App.java @ 174:249390dd24e7
Added foreign key constraint annotations to model classes.
flys-backend/trunk@1473 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 15 Mar 2011 14:49:56 +0000 |
parents | 7929f4144d2f |
children | bc3747a371cc |
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/App.java Mon Mar 14 15:40:14 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/App.java Tue Mar 15 14:49:56 2011 +0000 @@ -4,7 +4,22 @@ import org.hibernate.SessionFactory; +import de.intevation.flys.model.Annotation; +import de.intevation.flys.model.Attribute; +import de.intevation.flys.model.DischargeTable; +import de.intevation.flys.model.DischargeTableValue; +import de.intevation.flys.model.Gauge; +import de.intevation.flys.model.MainValueType; +import de.intevation.flys.model.NamedMainValues; +import de.intevation.flys.model.Position; +import de.intevation.flys.model.Range; import de.intevation.flys.model.River; +import de.intevation.flys.model.TimeInterval; +import de.intevation.flys.model.WstColumn; +import de.intevation.flys.model.WstColumnQRange; +import de.intevation.flys.model.WstColumnValue; +import de.intevation.flys.model.Wst; +import de.intevation.flys.model.WstQRange; import org.hibernate.dialect.resolver.DialectFactory; @@ -22,23 +37,45 @@ private static final String PASS = System.getProperty("flys.pass", "flys"); - public static void main(String [] args) - throws Exception - { - Configuration cfg = new Configuration(); - - cfg.addAnnotatedClass(River.class); + public static void dumpSchema(Configuration cfg) { + System.out.println("BEGIN;"); String [] setupScript = cfg.generateSchemaCreationScript( DialectFactory.constructDialect( "org.hibernate.dialect.PostgreSQLDialect")); for (String line: setupScript) { - System.out.println(line); + System.out.println(line + ";"); } + System.out.println("COMMIT;"); + } + + public static void main(String [] args) + throws Exception + { + Configuration cfg = new Configuration(); + + cfg.addAnnotatedClass(Annotation.class); + cfg.addAnnotatedClass(Attribute.class); + cfg.addAnnotatedClass(DischargeTable.class); + cfg.addAnnotatedClass(DischargeTableValue.class); + cfg.addAnnotatedClass(Gauge.class); + cfg.addAnnotatedClass(MainValueType.class); + cfg.addAnnotatedClass(NamedMainValues.class); + cfg.addAnnotatedClass(Position.class); + cfg.addAnnotatedClass(Range.class); + cfg.addAnnotatedClass(River.class); + cfg.addAnnotatedClass(TimeInterval.class); + cfg.addAnnotatedClass(WstColumn.class); + cfg.addAnnotatedClass(WstColumnQRange.class); + cfg.addAnnotatedClass(WstColumnValue.class); + cfg.addAnnotatedClass(Wst.class); + cfg.addAnnotatedClass(WstQRange.class); Properties props = new Properties(); + dumpSchema(cfg); + props.setProperty( Environment.DIALECT, "org.hibernate.dialect.PostgreSQLDialect");