From 35b9adb8cfea307ccc18b8f1091269d4b99f93c1 Mon Sep 17 00:00:00 2001 From: Victor Salaman Date: Thu, 25 Aug 2016 16:11:18 -0400 Subject: [PATCH] Removes default output to STDOUT on createSchema. - You can send output to STDOUT by supplying "-" as the filename. --- .../dbsupport/src/main/java/org/jpos/ee/DB.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/dbsupport/src/main/java/org/jpos/ee/DB.java b/modules/dbsupport/src/main/java/org/jpos/ee/DB.java index c134437ca1..465b023f35 100644 --- a/modules/dbsupport/src/main/java/org/jpos/ee/DB.java +++ b/modules/dbsupport/src/main/java/org/jpos/ee/DB.java @@ -247,15 +247,19 @@ public void createSchema(String outputFile, boolean create) throws HibernateExce try { // SchemaExport export = new SchemaExport(getMetadata()); SchemaExport export = new SchemaExport(); - EnumSet targetTypes = EnumSet.of(TargetType.STDOUT); + List targetTypes=new ArrayList<>(); if (outputFile != null) { - export.setOutputFile(outputFile); - export.setDelimiter(";"); - targetTypes.add(TargetType.SCRIPT); + if(outputFile.trim().equals("-")) targetTypes.add(TargetType.STDOUT); + else { + export.setOutputFile(outputFile); + export.setDelimiter(";"); + targetTypes.add(TargetType.SCRIPT); + } } if (create) targetTypes.add(TargetType.DATABASE); - export.create(targetTypes, getMetadata()); + if(targetTypes.size()>0) + export.create(EnumSet.copyOf(targetTypes), getMetadata()); } catch (IOException | ConfigurationException e) {