From d905d6b9e0f2ff9f5bd95eca6ac16f4902ecd3a9 Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Sun, 20 May 2012 21:31:01 +0200 Subject: [PATCH] [#875] Add XMLGenerator to export an INFORMATION_SCHEMA.xml [#1434] Add UniqueKeyDefinition.isPrimaryKey() for completeness [-] Removed CONSTRAINT_COLUMN_USAGE from HSQLDB generated INFORMATION_SCHEMA classes --- .../java/org/jooq/util/AbstractGenerator.java | 194 ++++++ .../java/org/jooq/util/DefaultGenerator.java | 163 +---- .../main/java/org/jooq/util/XMLGenerator.java | 326 ++++++++++ jOOQ-meta/pom.xml | 107 +++- .../java/org/jooq/util/DefaultRelations.java | 2 +- .../jooq/util/DefaultUniqueKeyDefinition.java | 9 +- .../org/jooq/util/UniqueKeyDefinition.java | 5 + .../information_schema/InformationSchema.java | 5 +- .../InformationSchemaFactory.java | 17 +- .../hsqldb/information_schema/Tables.java | 7 +- .../information_schema/tables/Columns.java | 11 +- .../tables/ConstraintColumnUsage.java | 80 --- .../tables/ElementTypes.java | 11 +- .../tables/KeyColumnUsage.java | 11 +- .../information_schema/tables/Parameters.java | 11 +- .../tables/ReferentialConstraints.java | 11 +- .../information_schema/tables/Routines.java | 11 +- .../information_schema/tables/Schemata.java | 11 +- .../information_schema/tables/Sequences.java | 11 +- .../tables/TableConstraints.java | 11 +- .../information_schema/tables/Tables.java | 11 +- .../xsd/information-schema-2.4.0.xsd | 579 ++++++++++++++++++ .../hsqldb/information_schema.properties | 2 +- .../oracle/library-information-schema.xml | 30 + ...racle test (INFORMATION_SCHEMA.xml).launch | 31 + 25 files changed, 1304 insertions(+), 363 deletions(-) create mode 100644 jOOQ-codegen/src/main/java/org/jooq/util/AbstractGenerator.java create mode 100644 jOOQ-codegen/src/main/java/org/jooq/util/XMLGenerator.java delete mode 100644 jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/ConstraintColumnUsage.java create mode 100644 jOOQ-meta/src/main/resources/xsd/information-schema-2.4.0.xsd create mode 100644 jOOQ-test/configuration/org/jooq/configuration/lukas/oracle/library-information-schema.xml create mode 100644 jOOQ-test/launch/GenerationTool Oracle test (INFORMATION_SCHEMA.xml).launch diff --git a/jOOQ-codegen/src/main/java/org/jooq/util/AbstractGenerator.java b/jOOQ-codegen/src/main/java/org/jooq/util/AbstractGenerator.java new file mode 100644 index 0000000000..3a5efacc22 --- /dev/null +++ b/jOOQ-codegen/src/main/java/org/jooq/util/AbstractGenerator.java @@ -0,0 +1,194 @@ +/** + * Copyright (c) 2009-2012, Lukas Eder, lukas.eder@gmail.com + * All rights reserved. + * + * This software is licensed to you under the Apache License, Version 2.0 + * (the "License"); You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name "jOOQ" nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +package org.jooq.util; + + +/** + * A common base implementation for {@link Generator} objects + * + * @author Lukas Eder + */ +abstract class AbstractGenerator implements Generator { + + boolean generateDeprecated = true; + boolean generateRelations = false; + boolean generateNavigationMethods = true; + boolean generateInstanceFields = true; + boolean generateGeneratedAnnotation = true; + boolean generateRecords = true; + boolean generatePojos = false; + boolean generateDaos = false; + boolean generateJPAAnnotations = false; + boolean generateValidationAnnotations = false; + + GeneratorStrategyWrapper strategy; + + @Override + public void setStrategy(GeneratorStrategy strategy) { + this.strategy = new GeneratorStrategyWrapper(this, strategy); + } + + @Override + public GeneratorStrategy getStrategy() { + return strategy; + } + + @Override + public boolean generateDeprecated() { + return generateDeprecated; + } + + @Override + public void setGenerateDeprecated(boolean generateDeprecated) { + this.generateDeprecated = generateDeprecated; + } + + @Override + public boolean generateRelations() { + return generateRelations; + } + + @Override + public void setGenerateRelations(boolean generateRelations) { + this.generateRelations = generateRelations; + } + + @Override + public boolean generateInstanceFields() { + return generateInstanceFields; + } + + @Override + public boolean generateNavigationMethods() { + return generateNavigationMethods; + } + + @Override + public void setGenerateNavigationMethods(boolean generateNavigationMethods) { + this.generateNavigationMethods = generateNavigationMethods; + } + + @Override + public void setGenerateInstanceFields(boolean generateInstanceFields) { + this.generateInstanceFields = generateInstanceFields; + } + + @Override + public boolean generateGeneratedAnnotation() { + return generateGeneratedAnnotation; + } + + @Override + public void setGenerateGeneratedAnnotation(boolean generateGeneratedAnnotation) { + this.generateGeneratedAnnotation = generateGeneratedAnnotation; + } + + @Override + public boolean generateRecords() { + + // [#1280] When DAOs are generated, Records must be generated, too + return generateRecords || generateDaos; + } + + @Override + public void setGenerateRecords(boolean generateRecords) { + this.generateRecords = generateRecords; + } + + @Override + public boolean generatePojos() { + + // [#1280] When DAOs are generated, POJOs must be generated, too + return generatePojos || generateDaos; + } + + @Override + public void setGeneratePojos(boolean generatePojos) { + this.generatePojos = generatePojos; + } + + @Override + public boolean generateDaos() { + return generateDaos; + } + + @Override + public void setGenerateDaos(boolean generateDaos) { + this.generateDaos = generateDaos; + } + + @Override + public boolean generateJPAAnnotations() { + return generateJPAAnnotations; + } + + @Override + public void setGenerateJPAAnnotations(boolean generateJPAAnnotations) { + this.generateJPAAnnotations = generateJPAAnnotations; + } + + @Override + public boolean generateValidationAnnotations() { + return generateValidationAnnotations; + } + + @Override + public void setGenerateValidationAnnotations(boolean generateValidationAnnotations) { + this.generateValidationAnnotations = generateValidationAnnotations; + } + + // ---- + + @Override + public void setTargetDirectory(String directory) { + strategy.setTargetDirectory(directory); + } + + @Override + public String getTargetDirectory() { + return strategy.getTargetDirectory(); + } + + @Override + public void setTargetPackage(String packageName) { + strategy.setTargetPackage(packageName); + } + + @Override + public String getTargetPackage() { + return strategy.getTargetPackage(); + } +} diff --git a/jOOQ-codegen/src/main/java/org/jooq/util/DefaultGenerator.java b/jOOQ-codegen/src/main/java/org/jooq/util/DefaultGenerator.java index 0f56d41e35..fef8250845 100644 --- a/jOOQ-codegen/src/main/java/org/jooq/util/DefaultGenerator.java +++ b/jOOQ-codegen/src/main/java/org/jooq/util/DefaultGenerator.java @@ -99,168 +99,19 @@ import org.jooq.util.GeneratorStrategy.Mode; /** - * A default implementation for code generation. Replace this code with your own - * logic, if you need your database schema represented in a different way. + * A default implementation for code generation. + *

+ * Replace this code with your own logic, if you need your database schema + * represented in a different way. *

* Note that you can also extend this class to generate POJO's or other stuff * entirely independent of jOOQ. * * @author Lukas Eder */ -public class DefaultGenerator implements Generator { +public class DefaultGenerator extends AbstractGenerator { - private static final JooqLogger log = JooqLogger.getLogger(DefaultGenerator.class); - - private boolean generateDeprecated = true; - private boolean generateRelations = false; - private boolean generateNavigationMethods = true; - private boolean generateInstanceFields = true; - private boolean generateGeneratedAnnotation = true; - private boolean generateRecords = true; - private boolean generatePojos = false; - private boolean generateDaos = false; - private boolean generateJPAAnnotations = false; - private boolean generateValidationAnnotations = false; - - private GeneratorStrategyWrapper strategy; - - @Override - public void setStrategy(GeneratorStrategy strategy) { - this.strategy = new GeneratorStrategyWrapper(this, strategy); - } - - @Override - public GeneratorStrategy getStrategy() { - return strategy; - } - - @Override - public boolean generateDeprecated() { - return generateDeprecated; - } - - @Override - public void setGenerateDeprecated(boolean generateDeprecated) { - this.generateDeprecated = generateDeprecated; - } - - @Override - public boolean generateRelations() { - return generateRelations; - } - - @Override - public void setGenerateRelations(boolean generateRelations) { - this.generateRelations = generateRelations; - } - - @Override - public boolean generateInstanceFields() { - return generateInstanceFields; - } - - @Override - public boolean generateNavigationMethods() { - return generateNavigationMethods; - } - - @Override - public void setGenerateNavigationMethods(boolean generateNavigationMethods) { - this.generateNavigationMethods = generateNavigationMethods; - } - - @Override - public void setGenerateInstanceFields(boolean generateInstanceFields) { - this.generateInstanceFields = generateInstanceFields; - } - - @Override - public boolean generateGeneratedAnnotation() { - return generateGeneratedAnnotation; - } - - @Override - public void setGenerateGeneratedAnnotation(boolean generateGeneratedAnnotation) { - this.generateGeneratedAnnotation = generateGeneratedAnnotation; - } - - @Override - public boolean generateRecords() { - - // [#1280] When DAOs are generated, Records must be generated, too - return generateRecords || generateDaos; - } - - @Override - public void setGenerateRecords(boolean generateRecords) { - this.generateRecords = generateRecords; - } - - @Override - public boolean generatePojos() { - - // [#1280] When DAOs are generated, POJOs must be generated, too - return generatePojos || generateDaos; - } - - @Override - public void setGeneratePojos(boolean generatePojos) { - this.generatePojos = generatePojos; - } - - @Override - public boolean generateDaos() { - return generateDaos; - } - - @Override - public void setGenerateDaos(boolean generateDaos) { - this.generateDaos = generateDaos; - } - - @Override - public boolean generateJPAAnnotations() { - return generateJPAAnnotations; - } - - @Override - public void setGenerateJPAAnnotations(boolean generateJPAAnnotations) { - this.generateJPAAnnotations = generateJPAAnnotations; - } - - @Override - public boolean generateValidationAnnotations() { - return generateValidationAnnotations; - } - - @Override - public void setGenerateValidationAnnotations(boolean generateValidationAnnotations) { - this.generateValidationAnnotations = generateValidationAnnotations; - } - - // ---- - - @Override - public void setTargetDirectory(String directory) { - strategy.setTargetDirectory(directory); - } - - @Override - public String getTargetDirectory() { - return strategy.getTargetDirectory(); - } - - @Override - public void setTargetPackage(String packageName) { - strategy.setTargetPackage(packageName); - } - - @Override - public String getTargetPackage() { - return strategy.getTargetPackage(); - } - - // ---- + private static final JooqLogger log = JooqLogger.getLogger(DefaultGenerator.class); @Override public void generate(Database database) throws IOException { @@ -273,7 +124,7 @@ public class DefaultGenerator implements Generator { log.info(" target package", getTargetPackage()); log.info("----------------------------------------------------------"); log.info(""); - log.info("Generation parameters"); + log.info("DefaultGenerator parameters"); log.info("----------------------------------------------------------"); log.info(" strategy", strategy.delegate.getClass()); log.info(" deprecated", generateDeprecated()); diff --git a/jOOQ-codegen/src/main/java/org/jooq/util/XMLGenerator.java b/jOOQ-codegen/src/main/java/org/jooq/util/XMLGenerator.java new file mode 100644 index 0000000000..5dacde4fa6 --- /dev/null +++ b/jOOQ-codegen/src/main/java/org/jooq/util/XMLGenerator.java @@ -0,0 +1,326 @@ +/** + * Copyright (c) 2009-2012, Lukas Eder, lukas.eder@gmail.com + * All rights reserved. + * + * This software is licensed to you under the Apache License, Version 2.0 + * (the "License"); You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name "jOOQ" nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +package org.jooq.util; + +import java.io.File; +import java.io.IOException; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.JAXB; + +import org.jooq.tools.JooqLogger; +import org.jooq.tools.StopWatch; +import org.jooq.util.information_schema.ColumnsRecordType; +import org.jooq.util.information_schema.ConstraintType; +import org.jooq.util.information_schema.InformationSchemaType; +import org.jooq.util.information_schema.KeyColumnUsageRecordType; +import org.jooq.util.information_schema.ParameterModeType; +import org.jooq.util.information_schema.ParametersRecordType; +import org.jooq.util.information_schema.ReferentialConstraintsRecordType; +import org.jooq.util.information_schema.RoutinesRecordType; +import org.jooq.util.information_schema.SchemataRecordType; +import org.jooq.util.information_schema.SequencesRecordType; +import org.jooq.util.information_schema.TableConstraintsRecordType; +import org.jooq.util.information_schema.TablesRecordType; +import org.jooq.util.information_schema.YesOrNoType; + +/** + * A generator for the INFORMATION_SCHEMA.xml file + *

+ * Use this generator to transform your schema meta information into an XML file + * that describes your schema according to the SQL standard INFORMATION SCHEMA. + * + * @author Lukas Eder + */ +public class XMLGenerator extends AbstractGenerator { + + private static final JooqLogger log = JooqLogger.getLogger(XMLGenerator.class); + + @Override + public void generate(Database database) throws IOException { + StopWatch watch = new StopWatch(); + + log.info("Database parameters"); + log.info("----------------------------------------------------------"); + log.info(" dialect", database.getDialect()); + log.info(" target dir", getTargetDirectory()); + log.info("----------------------------------------------------------"); + log.info(""); + log.info("XMLGenerator parameters"); + log.info("----------------------------------------------------------"); + log.info(" N/A"); + log.info("----------------------------------------------------------"); + + InformationSchemaType is = new InformationSchemaType(); + + // --------------------------------------------------------------------- + // XXX: INFORMATION_SCHEMA.SCHEMATA + // --------------------------------------------------------------------- + for (SchemaDefinition schema : database.getSchemata()) { + SchemataRecordType record = new SchemataRecordType(); + + record.setSCHEMANAME(schema.getOutputName()); + is.getSCHEMATA().add(record); + } + + // --------------------------------------------------------------------- + // XXX: INFORMATION_SCHEMA.TABLES + // --------------------------------------------------------------------- + for (TableDefinition table : database.getTables(null)) { + TablesRecordType rec = new TablesRecordType(); + SchemaDefinition schema = table.getSchema(); + + if (schema != null) { + rec.setTABLESCHEMA(schema.getOutputName()); + } + + rec.setTABLENAME(table.getOutputName()); + is.getTABLES().add(rec); + + // ----------------------------------------------------------------- + // XXX: INFORMATION_SCHEMA.COLUMNS + // ----------------------------------------------------------------- + for (ColumnDefinition column : table.getColumns()) { + ColumnsRecordType record = new ColumnsRecordType(); + + if (schema != null) { + record.setTABLESCHEMA(schema.getOutputName()); + } + + record.setTABLENAME(table.getOutputName()); + record.setCOLUMNNAME(column.getOutputName()); + record.setORDINALPOSITION(column.getPosition()); + record.setISIDENTITY(yn(column.isIdentity())); + record.setISNULLABLE(yn(column.isNullable())); + + // TODO: add data type information + + is.getCOLUMNS().add(record); + } + + // ----------------------------------------------------------------- + // XXX: INFORMATION_SCHEMA.TABLE_CONSTRAINTS + // ----------------------------------------------------------------- + for (UniqueKeyDefinition uniqueKey : table.getUniqueKeys()) { + TableConstraintsRecordType record = new TableConstraintsRecordType(); + + if (schema != null) { + record.setCONSTRAINTSCHEMA(schema.getOutputName()); + record.setTABLESCHEMA(schema.getOutputName()); + } + + record.setCONSTRAINTNAME(uniqueKey.getName()); + record.setCONSTRAINTTYPE(uniqueKey.isPrimaryKey() ? ConstraintType.PRIMARY_KEY : ConstraintType.UNIQUE); + record.setTABLENAME(table.getOutputName()); + + is.getTABLECONSTRAINTS().add(record); + } + + for (ForeignKeyDefinition foreignKey : table.getForeignKeys()) { + TableConstraintsRecordType record = new TableConstraintsRecordType(); + + if (schema != null) { + record.setCONSTRAINTSCHEMA(schema.getOutputName()); + record.setTABLESCHEMA(schema.getOutputName()); + } + + record.setCONSTRAINTNAME(foreignKey.getName()); + record.setCONSTRAINTTYPE(ConstraintType.FOREIGN_KEY); + record.setTABLENAME(table.getOutputName()); + + is.getTABLECONSTRAINTS().add(record); + } + + // ----------------------------------------------------------------- + // XXX: INFORMATION_SCHEMA.KEY_COLUMN_USAGE + // ----------------------------------------------------------------- + for (UniqueKeyDefinition uniqueKey : table.getUniqueKeys()) { + for (ColumnDefinition column : uniqueKey.getKeyColumns()) { + KeyColumnUsageRecordType record = new KeyColumnUsageRecordType(); + + if (schema != null) { + record.setCONSTRAINTSCHEMA(schema.getOutputName()); + record.setTABLESCHEMA(schema.getOutputName()); + } + + record.setTABLENAME(table.getOutputName()); + record.setCOLUMNNAME(column.getName()); + record.setCONSTRAINTNAME(uniqueKey.getName()); + record.setORDINALPOSITION(column.getPosition()); + + is.getKEYCOLUMNUSAGE().add(record); + } + } + + for (ForeignKeyDefinition foreignKey : table.getForeignKeys()) { + for (ColumnDefinition column : foreignKey.getKeyColumns()) { + KeyColumnUsageRecordType record = new KeyColumnUsageRecordType(); + + if (schema != null) { + record.setCONSTRAINTSCHEMA(schema.getOutputName()); + record.setTABLESCHEMA(schema.getOutputName()); + } + + record.setTABLENAME(table.getOutputName()); + record.setCOLUMNNAME(column.getName()); + record.setCONSTRAINTNAME(foreignKey.getName()); + + is.getKEYCOLUMNUSAGE().add(record); + } + } + + // ----------------------------------------------------------------- + // XXX: INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS + // ----------------------------------------------------------------- + for (ForeignKeyDefinition foreignKey : table.getForeignKeys()) { + UniqueKeyDefinition uniqueKey = foreignKey.getReferencedKey(); + ReferentialConstraintsRecordType record = new ReferentialConstraintsRecordType(); + + if (schema != null) { + record.setCONSTRAINTSCHEMA(schema.getOutputName()); + record.setUNIQUECONSTRAINTSCHEMA(uniqueKey.getSchema().getOutputName()); + } + + record.setCONSTRAINTNAME(foreignKey.getName()); + record.setUNIQUECONSTRAINTNAME(uniqueKey.getName()); + + is.getREFERENTIALCONSTRAINTS().add(record); + } + } + + // ----------------------------------------------------------------- + // XXX: INFORMATION_SCHEMA.SEQUENCES + // ----------------------------------------------------------------- + for (SequenceDefinition sequence : database.getSequences(null)) { + SequencesRecordType record = new SequencesRecordType(); + SchemaDefinition schema = sequence.getSchema(); + + if (schema != null) { + record.setSEQUENCESCHEMA(schema.getOutputName()); + } + + record.setSEQUENCENAME(sequence.getOutputName()); + + // TODO set data type + + is.getSEQUENCES().add(record); + } + + // --------------------------------------------------------------------- + // XXX: INFORMATION_SCHEMA.ROUTINES + // --------------------------------------------------------------------- + + List routines = new ArrayList(); + routines.addAll(database.getRoutines(null)); + for (PackageDefinition pkg : database.getPackages(null)) { + routines.addAll(pkg.getRoutines()); + } + + for (RoutineDefinition routine : routines) { + RoutinesRecordType rec = new RoutinesRecordType(); + SchemaDefinition schema = routine.getSchema(); + + if (schema != null) { + rec.setROUTINESCHEMA(schema.getOutputName()); + rec.setSPECIFICSCHEMA(schema.getOutputName()); + } + + if (routine.getPackage() != null) { + if (schema != null) { + rec.setMODULESCHEMA(schema.getOutputName()); + } + + rec.setMODULENAME(routine.getPackage().getOutputName()); + rec.setSCHEMALEVELROUTINE(YesOrNoType.NO); + } + else { + rec.setSCHEMALEVELROUTINE(YesOrNoType.YES); + } + + rec.setROUTINENAME(routine.getOutputName()); + rec.setSPECIFICNAME(routine.getOutputName()); + + // TODO deal with UDTs + // TODO set data type + + int position = 1; + for (ParameterDefinition parameter : routine.getAllParameters()) { + ParametersRecordType record = new ParametersRecordType(); + + if (schema != null) { + record.setSPECIFICSCHEMA(schema.getOutputName()); + } + + record.setSPECIFICNAME(routine.getName()); + record.setPARAMETERNAME(parameter.getName()); + record.setORDINALPOSITION(position++); + + if (routine.getInParameters().contains(parameter)) { + if (routine.getOutParameters().contains(parameter)) { + record.setPARAMETERMODE(ParameterModeType.INOUT); + } + else { + record.setPARAMETERMODE(ParameterModeType.IN); + } + } + else { + record.setPARAMETERMODE(ParameterModeType.OUT); + } + + // TODO set data type + // TODO [#1435] use ParameterDefinition.getPosition() + // TODO [#1436] use ParameterDefinition.getMode() + + is.getPARAMETERS().add(record); + } + + is.getROUTINES().add(rec); + } + + GenerationWriter out = new GenerationWriter(new File(getTargetDirectory(), "INFORMATION_SCHEMA.xml")); + StringWriter writer = new StringWriter(); + JAXB.marshal(is, writer); + out.print(writer.toString()); + out.close(); + watch.splitInfo("GENERATION FINISHED!"); + } + + private YesOrNoType yn(boolean value) { + return value ? YesOrNoType.YES : YesOrNoType.NO; + } +} diff --git a/jOOQ-meta/pom.xml b/jOOQ-meta/pom.xml index 7bbbbe71e4..905d5fb004 100644 --- a/jOOQ-meta/pom.xml +++ b/jOOQ-meta/pom.xml @@ -45,44 +45,85 @@ 0.8.1 + information_schema + + generate + + + true + false + src/main/resources/xsd + + information-schema-2.4.0.xsd + + org.jooq.util.information_schema + + -Xxew + -Xxew:instantiate lazy + -Xxew:delete + -Xfluent-api + -Xdefault-value + + + + com.github.jaxb-xew-plugin + jaxb-xew-plugin + 1.0 + + + org.jvnet.jaxb2_commons + jaxb2-fluent-api + 3.0 + + + org.jvnet.jaxb2_commons + jaxb2-default-value + 1.1 + + + + + + + configuration generate + + true + false + src/main/resources/xsd + + jooq-codegen-2.4.0.xsd + + org.jooq.util.jaxb + + -Xxew + -Xxew:instantiate lazy + -Xxew:delete + -Xfluent-api + -Xdefault-value + + + + com.github.jaxb-xew-plugin + jaxb-xew-plugin + 1.0 + + + org.jvnet.jaxb2_commons + jaxb2-fluent-api + 3.0 + + + org.jvnet.jaxb2_commons + jaxb2-default-value + 1.1 + + + - - true - false - src/main/resources/xsd - - jooq-codegen-2.4.0.xsd - - org.jooq.util.jaxb - - -Xxew - -Xxew:instantiate lazy - -Xxew:delete - -Xfluent-api - -Xdefault-value - - - - com.github.jaxb-xew-plugin - jaxb-xew-plugin - 1.0 - - - org.jvnet.jaxb2_commons - jaxb2-fluent-api - 3.0 - - - org.jvnet.jaxb2_commons - jaxb2-default-value - 1.1 - - - diff --git a/jOOQ-meta/src/main/java/org/jooq/util/DefaultRelations.java b/jOOQ-meta/src/main/java/org/jooq/util/DefaultRelations.java index 63a5c0976b..f036168ae8 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/DefaultRelations.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/DefaultRelations.java @@ -78,7 +78,7 @@ public class DefaultRelations implements Relations { UniqueKeyDefinition key = uniqueKeys.get(key(column, keyName)); if (key == null) { - key = new DefaultUniqueKeyDefinition(column.getSchema(), keyName, column.getContainer()); + key = new DefaultUniqueKeyDefinition(column.getSchema(), keyName, column.getContainer(), isPK); uniqueKeys.put(key(column, keyName), key); if (isPK) { diff --git a/jOOQ-meta/src/main/java/org/jooq/util/DefaultUniqueKeyDefinition.java b/jOOQ-meta/src/main/java/org/jooq/util/DefaultUniqueKeyDefinition.java index d29ff2c47b..34981ff7f3 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/DefaultUniqueKeyDefinition.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/DefaultUniqueKeyDefinition.java @@ -44,13 +44,20 @@ public class DefaultUniqueKeyDefinition extends AbstractDefinition implements Un private final List foreignKeys; private final List keyColumns; private final TableDefinition table; + private final boolean isPrimaryKey; - public DefaultUniqueKeyDefinition(SchemaDefinition schema, String name, TableDefinition table) { + public DefaultUniqueKeyDefinition(SchemaDefinition schema, String name, TableDefinition table, boolean isPrimaryKey) { super(schema.getDatabase(), schema, name, null); this.foreignKeys = new ArrayList(); this.keyColumns = new ArrayList(); this.table = table; + this.isPrimaryKey = isPrimaryKey; + } + + @Override + public boolean isPrimaryKey() { + return isPrimaryKey; } @Override diff --git a/jOOQ-meta/src/main/java/org/jooq/util/UniqueKeyDefinition.java b/jOOQ-meta/src/main/java/org/jooq/util/UniqueKeyDefinition.java index 754c54e164..71932738af 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/UniqueKeyDefinition.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/UniqueKeyDefinition.java @@ -47,6 +47,11 @@ import java.util.List; */ public interface UniqueKeyDefinition extends Definition { + /** + * Whether this unique key is the primary key + */ + boolean isPrimaryKey(); + /** * The list of columns making up the primary key. */ diff --git a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/InformationSchema.java b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/InformationSchema.java index 9c1d30d5bc..99d646228a 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/InformationSchema.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/InformationSchema.java @@ -6,11 +6,11 @@ package org.jooq.util.hsqldb.information_schema; /** * This class is generated by jOOQ. */ -@javax.annotation.Generated(value = {"http://www.jooq.org", "2.3.0"}, +@javax.annotation.Generated(value = {"http://www.jooq.org", "2.4.0"}, comments = "This class is generated by jOOQ") public class InformationSchema extends org.jooq.impl.SchemaImpl { - private static final long serialVersionUID = 688591995; + private static final long serialVersionUID = -1496897811; /** * The singleton instance of INFORMATION_SCHEMA @@ -28,7 +28,6 @@ public class InformationSchema extends org.jooq.impl.SchemaImpl { public final java.util.List> getTables() { return java.util.Arrays.>asList( org.jooq.util.hsqldb.information_schema.tables.Columns.COLUMNS, - org.jooq.util.hsqldb.information_schema.tables.ConstraintColumnUsage.CONSTRAINT_COLUMN_USAGE, org.jooq.util.hsqldb.information_schema.tables.ElementTypes.ELEMENT_TYPES, org.jooq.util.hsqldb.information_schema.tables.KeyColumnUsage.KEY_COLUMN_USAGE, org.jooq.util.hsqldb.information_schema.tables.Parameters.PARAMETERS, diff --git a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/InformationSchemaFactory.java b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/InformationSchemaFactory.java index 62d6da286b..c58ed616e8 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/InformationSchemaFactory.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/InformationSchemaFactory.java @@ -6,11 +6,11 @@ package org.jooq.util.hsqldb.information_schema; /** * This class is generated by jOOQ. */ -@javax.annotation.Generated(value = {"http://www.jooq.org", "2.3.0"}, +@javax.annotation.Generated(value = {"http://www.jooq.org", "2.4.0"}, comments = "This class is generated by jOOQ") public class InformationSchemaFactory extends org.jooq.util.hsqldb.HSQLDBFactory { - private static final long serialVersionUID = 612688309; + private static final long serialVersionUID = 1709007759; /** * Create a factory with a connection @@ -19,6 +19,8 @@ public class InformationSchemaFactory extends org.jooq.util.hsqldb.HSQLDBFactory */ public InformationSchemaFactory(java.sql.Connection connection) { super(connection); + + initDefaultSchema(); } /** @@ -29,5 +31,16 @@ public class InformationSchemaFactory extends org.jooq.util.hsqldb.HSQLDBFactory */ public InformationSchemaFactory(java.sql.Connection connection, org.jooq.conf.Settings settings) { super(connection, settings); + + initDefaultSchema(); + } + + /** + * Initialise the render mapping's default schema. + *

+ * For convenience, this schema-specific factory should override any pre-existing setting + */ + private final void initDefaultSchema() { + org.jooq.conf.SettingsTools.getRenderMapping(getSettings()).setDefaultSchema(org.jooq.util.hsqldb.information_schema.InformationSchema.INFORMATION_SCHEMA.getName()); } } diff --git a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/Tables.java b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/Tables.java index e8a097f28e..94162af166 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/Tables.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/Tables.java @@ -8,7 +8,7 @@ package org.jooq.util.hsqldb.information_schema; * * Convenience access to all tables in INFORMATION_SCHEMA */ -@javax.annotation.Generated(value = {"http://www.jooq.org", "2.3.0"}, +@javax.annotation.Generated(value = {"http://www.jooq.org", "2.4.0"}, comments = "This class is generated by jOOQ") public final class Tables { @@ -17,11 +17,6 @@ public final class Tables { */ public static org.jooq.util.hsqldb.information_schema.tables.Columns COLUMNS = org.jooq.util.hsqldb.information_schema.tables.Columns.COLUMNS; - /** - * The table INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE - */ - public static org.jooq.util.hsqldb.information_schema.tables.ConstraintColumnUsage CONSTRAINT_COLUMN_USAGE = org.jooq.util.hsqldb.information_schema.tables.ConstraintColumnUsage.CONSTRAINT_COLUMN_USAGE; - /** * The table INFORMATION_SCHEMA.ELEMENT_TYPES */ diff --git a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/Columns.java b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/Columns.java index 4e7b332ea0..27aa4e52dc 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/Columns.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/Columns.java @@ -6,28 +6,23 @@ package org.jooq.util.hsqldb.information_schema.tables; /** * This class is generated by jOOQ. */ -@javax.annotation.Generated(value = {"http://www.jooq.org", "2.3.0"}, +@javax.annotation.Generated(value = {"http://www.jooq.org", "2.4.0"}, comments = "This class is generated by jOOQ") public class Columns extends org.jooq.impl.TableImpl { - private static final long serialVersionUID = 730335754; + private static final long serialVersionUID = 716161733; /** * The singleton instance of INFORMATION_SCHEMA.COLUMNS */ public static final org.jooq.util.hsqldb.information_schema.tables.Columns COLUMNS = new org.jooq.util.hsqldb.information_schema.tables.Columns(); - /** - * The class holding records for this type - */ - private static final java.lang.Class __RECORD_TYPE = org.jooq.Record.class; - /** * The class holding records for this type */ @Override public java.lang.Class getRecordType() { - return __RECORD_TYPE; + return org.jooq.Record.class; } /** diff --git a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/ConstraintColumnUsage.java b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/ConstraintColumnUsage.java deleted file mode 100644 index d5cd71a220..0000000000 --- a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/ConstraintColumnUsage.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * This class is generated by jOOQ - */ -package org.jooq.util.hsqldb.information_schema.tables; - -/** - * This class is generated by jOOQ. - */ -@javax.annotation.Generated(value = {"http://www.jooq.org", "2.3.0"}, - comments = "This class is generated by jOOQ") -public class ConstraintColumnUsage extends org.jooq.impl.TableImpl { - - private static final long serialVersionUID = -1433884199; - - /** - * The singleton instance of INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE - */ - public static final org.jooq.util.hsqldb.information_schema.tables.ConstraintColumnUsage CONSTRAINT_COLUMN_USAGE = new org.jooq.util.hsqldb.information_schema.tables.ConstraintColumnUsage(); - - /** - * The class holding records for this type - */ - private static final java.lang.Class __RECORD_TYPE = org.jooq.Record.class; - - /** - * The class holding records for this type - */ - @Override - public java.lang.Class getRecordType() { - return __RECORD_TYPE; - } - - /** - * An uncommented item - */ - public final org.jooq.TableField TABLE_CATALOG = createField("TABLE_CATALOG", org.jooq.impl.SQLDataType.VARCHAR, this); - - /** - * An uncommented item - */ - public final org.jooq.TableField TABLE_SCHEMA = createField("TABLE_SCHEMA", org.jooq.impl.SQLDataType.VARCHAR, this); - - /** - * An uncommented item - */ - public final org.jooq.TableField TABLE_NAME = createField("TABLE_NAME", org.jooq.impl.SQLDataType.VARCHAR, this); - - /** - * An uncommented item - */ - public final org.jooq.TableField COLUMN_NAME = createField("COLUMN_NAME", org.jooq.impl.SQLDataType.VARCHAR, this); - - /** - * An uncommented item - */ - public final org.jooq.TableField CONSTRAINT_CATALOG = createField("CONSTRAINT_CATALOG", org.jooq.impl.SQLDataType.VARCHAR, this); - - /** - * An uncommented item - */ - public final org.jooq.TableField CONSTRAINT_SCHEMA = createField("CONSTRAINT_SCHEMA", org.jooq.impl.SQLDataType.VARCHAR, this); - - /** - * An uncommented item - */ - public final org.jooq.TableField CONSTRAINT_NAME = createField("CONSTRAINT_NAME", org.jooq.impl.SQLDataType.VARCHAR, this); - - public ConstraintColumnUsage() { - super("CONSTRAINT_COLUMN_USAGE", org.jooq.util.hsqldb.information_schema.InformationSchema.INFORMATION_SCHEMA); - } - - public ConstraintColumnUsage(java.lang.String alias) { - super(alias, org.jooq.util.hsqldb.information_schema.InformationSchema.INFORMATION_SCHEMA, org.jooq.util.hsqldb.information_schema.tables.ConstraintColumnUsage.CONSTRAINT_COLUMN_USAGE); - } - - @Override - public org.jooq.util.hsqldb.information_schema.tables.ConstraintColumnUsage as(java.lang.String alias) { - return new org.jooq.util.hsqldb.information_schema.tables.ConstraintColumnUsage(alias); - } -} diff --git a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/ElementTypes.java b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/ElementTypes.java index 5ca5c44062..f6826101f4 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/ElementTypes.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/ElementTypes.java @@ -6,28 +6,23 @@ package org.jooq.util.hsqldb.information_schema.tables; /** * This class is generated by jOOQ. */ -@javax.annotation.Generated(value = {"http://www.jooq.org", "2.3.0"}, +@javax.annotation.Generated(value = {"http://www.jooq.org", "2.4.0"}, comments = "This class is generated by jOOQ") public class ElementTypes extends org.jooq.impl.TableImpl { - private static final long serialVersionUID = -1943758981; + private static final long serialVersionUID = 521837036; /** * The singleton instance of INFORMATION_SCHEMA.ELEMENT_TYPES */ public static final org.jooq.util.hsqldb.information_schema.tables.ElementTypes ELEMENT_TYPES = new org.jooq.util.hsqldb.information_schema.tables.ElementTypes(); - /** - * The class holding records for this type - */ - private static final java.lang.Class __RECORD_TYPE = org.jooq.Record.class; - /** * The class holding records for this type */ @Override public java.lang.Class getRecordType() { - return __RECORD_TYPE; + return org.jooq.Record.class; } /** diff --git a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/KeyColumnUsage.java b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/KeyColumnUsage.java index 50340d6467..3271ba2ebf 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/KeyColumnUsage.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/KeyColumnUsage.java @@ -6,28 +6,23 @@ package org.jooq.util.hsqldb.information_schema.tables; /** * This class is generated by jOOQ. */ -@javax.annotation.Generated(value = {"http://www.jooq.org", "2.3.0"}, +@javax.annotation.Generated(value = {"http://www.jooq.org", "2.4.0"}, comments = "This class is generated by jOOQ") public class KeyColumnUsage extends org.jooq.impl.TableImpl { - private static final long serialVersionUID = -1468929901; + private static final long serialVersionUID = -172117938; /** * The singleton instance of INFORMATION_SCHEMA.KEY_COLUMN_USAGE */ public static final org.jooq.util.hsqldb.information_schema.tables.KeyColumnUsage KEY_COLUMN_USAGE = new org.jooq.util.hsqldb.information_schema.tables.KeyColumnUsage(); - /** - * The class holding records for this type - */ - private static final java.lang.Class __RECORD_TYPE = org.jooq.Record.class; - /** * The class holding records for this type */ @Override public java.lang.Class getRecordType() { - return __RECORD_TYPE; + return org.jooq.Record.class; } /** diff --git a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/Parameters.java b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/Parameters.java index d479c31660..b35e941db7 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/Parameters.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/Parameters.java @@ -6,28 +6,23 @@ package org.jooq.util.hsqldb.information_schema.tables; /** * This class is generated by jOOQ. */ -@javax.annotation.Generated(value = {"http://www.jooq.org", "2.3.0"}, +@javax.annotation.Generated(value = {"http://www.jooq.org", "2.4.0"}, comments = "This class is generated by jOOQ") public class Parameters extends org.jooq.impl.TableImpl { - private static final long serialVersionUID = 1543475117; + private static final long serialVersionUID = 1344780644; /** * The singleton instance of INFORMATION_SCHEMA.PARAMETERS */ public static final org.jooq.util.hsqldb.information_schema.tables.Parameters PARAMETERS = new org.jooq.util.hsqldb.information_schema.tables.Parameters(); - /** - * The class holding records for this type - */ - private static final java.lang.Class __RECORD_TYPE = org.jooq.Record.class; - /** * The class holding records for this type */ @Override public java.lang.Class getRecordType() { - return __RECORD_TYPE; + return org.jooq.Record.class; } /** diff --git a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/ReferentialConstraints.java b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/ReferentialConstraints.java index a563486388..2a6dd201fb 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/ReferentialConstraints.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/ReferentialConstraints.java @@ -6,28 +6,23 @@ package org.jooq.util.hsqldb.information_schema.tables; /** * This class is generated by jOOQ. */ -@javax.annotation.Generated(value = {"http://www.jooq.org", "2.3.0"}, +@javax.annotation.Generated(value = {"http://www.jooq.org", "2.4.0"}, comments = "This class is generated by jOOQ") public class ReferentialConstraints extends org.jooq.impl.TableImpl { - private static final long serialVersionUID = -1952528247; + private static final long serialVersionUID = 398327730; /** * The singleton instance of INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS */ public static final org.jooq.util.hsqldb.information_schema.tables.ReferentialConstraints REFERENTIAL_CONSTRAINTS = new org.jooq.util.hsqldb.information_schema.tables.ReferentialConstraints(); - /** - * The class holding records for this type - */ - private static final java.lang.Class __RECORD_TYPE = org.jooq.Record.class; - /** * The class holding records for this type */ @Override public java.lang.Class getRecordType() { - return __RECORD_TYPE; + return org.jooq.Record.class; } /** diff --git a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/Routines.java b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/Routines.java index 84f418441d..57fc26ecdb 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/Routines.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/Routines.java @@ -6,28 +6,23 @@ package org.jooq.util.hsqldb.information_schema.tables; /** * This class is generated by jOOQ. */ -@javax.annotation.Generated(value = {"http://www.jooq.org", "2.3.0"}, +@javax.annotation.Generated(value = {"http://www.jooq.org", "2.4.0"}, comments = "This class is generated by jOOQ") public class Routines extends org.jooq.impl.TableImpl { - private static final long serialVersionUID = -106550271; + private static final long serialVersionUID = -1031282270; /** * The singleton instance of INFORMATION_SCHEMA.ROUTINES */ public static final org.jooq.util.hsqldb.information_schema.tables.Routines ROUTINES = new org.jooq.util.hsqldb.information_schema.tables.Routines(); - /** - * The class holding records for this type - */ - private static final java.lang.Class __RECORD_TYPE = org.jooq.Record.class; - /** * The class holding records for this type */ @Override public java.lang.Class getRecordType() { - return __RECORD_TYPE; + return org.jooq.Record.class; } /** diff --git a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/Schemata.java b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/Schemata.java index 7fac6473a8..c23431d4b3 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/Schemata.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/Schemata.java @@ -6,28 +6,23 @@ package org.jooq.util.hsqldb.information_schema.tables; /** * This class is generated by jOOQ. */ -@javax.annotation.Generated(value = {"http://www.jooq.org", "2.3.0"}, +@javax.annotation.Generated(value = {"http://www.jooq.org", "2.4.0"}, comments = "This class is generated by jOOQ") public class Schemata extends org.jooq.impl.TableImpl { - private static final long serialVersionUID = 2070767037; + private static final long serialVersionUID = -420534788; /** * The singleton instance of INFORMATION_SCHEMA.SCHEMATA */ public static final org.jooq.util.hsqldb.information_schema.tables.Schemata SCHEMATA = new org.jooq.util.hsqldb.information_schema.tables.Schemata(); - /** - * The class holding records for this type - */ - private static final java.lang.Class __RECORD_TYPE = org.jooq.Record.class; - /** * The class holding records for this type */ @Override public java.lang.Class getRecordType() { - return __RECORD_TYPE; + return org.jooq.Record.class; } /** diff --git a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/Sequences.java b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/Sequences.java index 28bdabb4b5..2c3167ec92 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/Sequences.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/Sequences.java @@ -6,28 +6,23 @@ package org.jooq.util.hsqldb.information_schema.tables; /** * This class is generated by jOOQ. */ -@javax.annotation.Generated(value = {"http://www.jooq.org", "2.3.0"}, +@javax.annotation.Generated(value = {"http://www.jooq.org", "2.4.0"}, comments = "This class is generated by jOOQ") public class Sequences extends org.jooq.impl.TableImpl { - private static final long serialVersionUID = -616213725; + private static final long serialVersionUID = -770452354; /** * The singleton instance of INFORMATION_SCHEMA.SEQUENCES */ public static final org.jooq.util.hsqldb.information_schema.tables.Sequences SEQUENCES = new org.jooq.util.hsqldb.information_schema.tables.Sequences(); - /** - * The class holding records for this type - */ - private static final java.lang.Class __RECORD_TYPE = org.jooq.Record.class; - /** * The class holding records for this type */ @Override public java.lang.Class getRecordType() { - return __RECORD_TYPE; + return org.jooq.Record.class; } /** diff --git a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/TableConstraints.java b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/TableConstraints.java index 3e9e68fb2e..4c058d530b 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/TableConstraints.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/TableConstraints.java @@ -6,28 +6,23 @@ package org.jooq.util.hsqldb.information_schema.tables; /** * This class is generated by jOOQ. */ -@javax.annotation.Generated(value = {"http://www.jooq.org", "2.3.0"}, +@javax.annotation.Generated(value = {"http://www.jooq.org", "2.4.0"}, comments = "This class is generated by jOOQ") public class TableConstraints extends org.jooq.impl.TableImpl { - private static final long serialVersionUID = -522229083; + private static final long serialVersionUID = 2101828900; /** * The singleton instance of INFORMATION_SCHEMA.TABLE_CONSTRAINTS */ public static final org.jooq.util.hsqldb.information_schema.tables.TableConstraints TABLE_CONSTRAINTS = new org.jooq.util.hsqldb.information_schema.tables.TableConstraints(); - /** - * The class holding records for this type - */ - private static final java.lang.Class __RECORD_TYPE = org.jooq.Record.class; - /** * The class holding records for this type */ @Override public java.lang.Class getRecordType() { - return __RECORD_TYPE; + return org.jooq.Record.class; } /** diff --git a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/Tables.java b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/Tables.java index 6f51f4dc89..90793e0efa 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/Tables.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/hsqldb/information_schema/tables/Tables.java @@ -6,28 +6,23 @@ package org.jooq.util.hsqldb.information_schema.tables; /** * This class is generated by jOOQ. */ -@javax.annotation.Generated(value = {"http://www.jooq.org", "2.3.0"}, +@javax.annotation.Generated(value = {"http://www.jooq.org", "2.4.0"}, comments = "This class is generated by jOOQ") public class Tables extends org.jooq.impl.TableImpl { - private static final long serialVersionUID = -415539098; + private static final long serialVersionUID = 857056825; /** * The singleton instance of INFORMATION_SCHEMA.TABLES */ public static final org.jooq.util.hsqldb.information_schema.tables.Tables TABLES = new org.jooq.util.hsqldb.information_schema.tables.Tables(); - /** - * The class holding records for this type - */ - private static final java.lang.Class __RECORD_TYPE = org.jooq.Record.class; - /** * The class holding records for this type */ @Override public java.lang.Class getRecordType() { - return __RECORD_TYPE; + return org.jooq.Record.class; } /** diff --git a/jOOQ-meta/src/main/resources/xsd/information-schema-2.4.0.xsd b/jOOQ-meta/src/main/resources/xsd/information-schema-2.4.0.xsd new file mode 100644 index 0000000000..2ed0fa24d0 --- /dev/null +++ b/jOOQ-meta/src/main/resources/xsd/information-schema-2.4.0.xsd @@ -0,0 +1,579 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/jOOQ-test/configuration/org/jooq/configuration/lukas/hsqldb/information_schema.properties b/jOOQ-test/configuration/org/jooq/configuration/lukas/hsqldb/information_schema.properties index 6efdbf271f..19b5931af4 100644 --- a/jOOQ-test/configuration/org/jooq/configuration/lukas/hsqldb/information_schema.properties +++ b/jOOQ-test/configuration/org/jooq/configuration/lukas/hsqldb/information_schema.properties @@ -7,7 +7,7 @@ jdbc.Password= generator=org.jooq.util.DefaultGenerator generator.database=org.jooq.util.hsqldb.HSQLDBDatabase -generator.database.includes=SCHEMATA,TABLES,COLUMNS,REFERENTIAL_CONSTRAINTS,TABLE_CONSTRAINTS,CONSTRAINT_COLUMN_USAGE,KEY_COLUMN_USAGE,ROUTINES,PARAMETERS,SEQUENCES,ELEMENT_TYPES +generator.database.includes=SCHEMATA,TABLES,COLUMNS,REFERENTIAL_CONSTRAINTS,TABLE_CONSTRAINTS,KEY_COLUMN_USAGE,ROUTINES,PARAMETERS,SEQUENCES,ELEMENT_TYPES generator.database.excludes= generator.generate.deprecated=false generator.generate.fields=both diff --git a/jOOQ-test/configuration/org/jooq/configuration/lukas/oracle/library-information-schema.xml b/jOOQ-test/configuration/org/jooq/configuration/lukas/oracle/library-information-schema.xml new file mode 100644 index 0000000000..9d55d56ac1 --- /dev/null +++ b/jOOQ-test/configuration/org/jooq/configuration/lukas/oracle/library-information-schema.xml @@ -0,0 +1,30 @@ + + + + oracle.jdbc.OracleDriver + jdbc:oracle:thin:@localhost:1521:xe + TEST + TEST + + + org.jooq.util.XMLGenerator + + org.jooq.util.oracle.OracleDatabase + .* + T_BOOK_DETAILS,S_TRIGGERS_SEQUENCE,.*976.* + false + true + + + TEST + + + MULTI_SCHEMA + + + + + ./src/org/jooq/test/_/information_schema/oracle + + + diff --git a/jOOQ-test/launch/GenerationTool Oracle test (INFORMATION_SCHEMA.xml).launch b/jOOQ-test/launch/GenerationTool Oracle test (INFORMATION_SCHEMA.xml).launch new file mode 100644 index 0000000000..b2e7bc6c0b --- /dev/null +++ b/jOOQ-test/launch/GenerationTool Oracle test (INFORMATION_SCHEMA.xml).launch @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +