diff --git a/orm/src/main/java/org/hibernate/tool/api/export/ExporterFactory.java b/orm/src/main/java/org/hibernate/tool/api/export/ExporterFactory.java index 0ea200b8c9..1d58990f40 100644 --- a/orm/src/main/java/org/hibernate/tool/api/export/ExporterFactory.java +++ b/orm/src/main/java/org/hibernate/tool/api/export/ExporterFactory.java @@ -23,21 +23,22 @@ import org.hibernate.tool.util.ReflectionUtil; public class ExporterFactory { - - public static Exporter createExporter(String exporterClassName) { - Exporter result = null; - try { - Class exporterClass = ReflectionUtil.classForName(exporterClassName); - Constructor exporterConstructor = exporterClass.getConstructor(new Class[] {}); - result = (Exporter)exporterConstructor.newInstance(); - } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | NoSuchMethodException | SecurityException | IllegalArgumentException | InvocationTargetException exception) { - throw new RuntimeException("An exporter of class '" + exporterClassName + "' could not be created", exception); - } - return result; - } - - public static Exporter createExporter(ExporterType exporterType) { - return createExporter(exporterType.className()); - } + + public static Exporter createExporter(String exporterClassName) { + Exporter result; + try { + Class exporterClass = ReflectionUtil.classForName(exporterClassName); + Constructor exporterConstructor = exporterClass.getConstructor(); + result = (Exporter)exporterConstructor.newInstance(); + } + catch (ClassNotFoundException | IllegalAccessException | InstantiationException | NoSuchMethodException | SecurityException | IllegalArgumentException | InvocationTargetException exception) { + throw new RuntimeException("An exporter of class '" + exporterClassName + "' could not be created", exception); + } + return result; + } + + public static Exporter createExporter(ExporterType exporterType) { + return createExporter(exporterType.className()); + } } diff --git a/orm/src/main/java/org/hibernate/tool/api/java/DefaultJavaPrettyPrinterStrategy.java b/orm/src/main/java/org/hibernate/tool/api/java/DefaultJavaPrettyPrinterStrategy.java index 91f7d54e64..4a5eebfb8c 100644 --- a/orm/src/main/java/org/hibernate/tool/api/java/DefaultJavaPrettyPrinterStrategy.java +++ b/orm/src/main/java/org/hibernate/tool/api/java/DefaultJavaPrettyPrinterStrategy.java @@ -20,23 +20,23 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; -import java.util.Map; import com.google.googlejavaformat.java.Formatter; import com.google.googlejavaformat.java.FormatterException; public class DefaultJavaPrettyPrinterStrategy { - public boolean formatFile(File file) { - try { - Formatter formatter = new Formatter(); - String toFormat = new String(Files.readAllBytes(file.toPath())); - String toWrite = formatter.formatSource(toFormat); - Files.write(file.toPath(), toWrite.getBytes()); - return true; - } catch (IOException | FormatterException e) { - throw new RuntimeException(e); - } - } + public boolean formatFile(File file) { + try { + Formatter formatter = new Formatter(); + String toFormat = new String(Files.readAllBytes(file.toPath())); + String toWrite = formatter.formatSource(toFormat); + Files.write(file.toPath(), toWrite.getBytes()); + return true; + } + catch (IOException | FormatterException e) { + throw new RuntimeException(e); + } + } } \ No newline at end of file diff --git a/orm/src/main/java/org/hibernate/tool/api/reveng/RevengDialectFactory.java b/orm/src/main/java/org/hibernate/tool/api/reveng/RevengDialectFactory.java index 7696d9e453..3687e616e7 100644 --- a/orm/src/main/java/org/hibernate/tool/api/reveng/RevengDialectFactory.java +++ b/orm/src/main/java/org/hibernate/tool/api/reveng/RevengDialectFactory.java @@ -35,78 +35,82 @@ import org.hibernate.tool.internal.reveng.dialect.SQLServerMetaDataDialect; public class RevengDialectFactory { - - private RevengDialectFactory() {} - public static RevengDialect createMetaDataDialect(Dialect dialect, Properties cfg) { - String property = cfg.getProperty( "hibernatetool.metadatadialect" ); - RevengDialect mdd = fromClassName(property); - if(mdd==null) { - mdd = fromDialect(dialect); - } - if(mdd==null) { - mdd = fromDialectName(dialect.getClass().getName()); - } - if(mdd==null) { - mdd = new JDBCMetaDataDialect(); - } - return mdd; - } + private RevengDialectFactory() {} - public static RevengDialect fromClassName(String property) { - if ( property != null ) { - try { - Class revengDialectClass = ReflectHelper.classForName( - property, - RevengDialectFactory.class ); - Constructor revengDialectConstructor = revengDialectClass.getConstructor( - new Class[] {}); - return (RevengDialect)revengDialectConstructor.newInstance(); - } - catch (Throwable e) { - throw new RuntimeException( - "Could not load MetaDataDialect: " + property, e ); - } - } else { - return null; - } - } - - public static RevengDialect fromDialect(Dialect dialect) { - if(dialect!=null) { - if(dialect instanceof OracleDialect) { - return new OracleMetaDataDialect(); - } else if (dialect instanceof H2Dialect) { - return new H2MetaDataDialect(); - } else if (dialect instanceof MySQLDialect) { - return new MySQLMetaDataDialect(); - } else if (dialect instanceof HSQLDialect) { - return new HSQLMetaDataDialect(); - }else if (dialect instanceof SQLServerDialect) { - return new SQLServerMetaDataDialect(); - } - } - return null; - } - - public static RevengDialect fromDialectName(String dialect) { - if (dialect.toLowerCase().contains("oracle")) { - return new OracleMetaDataDialect(); - } - if (dialect.toLowerCase().contains("mysql")) { - return new MySQLMetaDataDialect(); - } - if (dialect.toLowerCase().contains("h2")) { - return new H2MetaDataDialect(); - } - if (dialect.toLowerCase().contains("hsql")) { - return new HSQLMetaDataDialect(); - } - if (dialect.toLowerCase().contains("sqlserver")) { - return new SQLServerMetaDataDialect(); - } - return null; - } + public static RevengDialect createMetaDataDialect(Dialect dialect, Properties cfg) { + String property = cfg.getProperty( "hibernatetool.metadatadialect" ); + RevengDialect mdd = fromClassName(property); + if(mdd==null) { + mdd = fromDialect(dialect); + } + if(mdd==null) { + mdd = fromDialectName(dialect.getClass().getName()); + } + if(mdd==null) { + mdd = new JDBCMetaDataDialect(); + } + return mdd; + } + + public static RevengDialect fromClassName(String property) { + if ( property != null ) { + try { + Class revengDialectClass = ReflectHelper.classForName( + property, + RevengDialectFactory.class ); + Constructor revengDialectConstructor = revengDialectClass.getConstructor(); + return (RevengDialect)revengDialectConstructor.newInstance(); + } + catch (Throwable e) { + throw new RuntimeException( + "Could not load MetaDataDialect: " + property, e ); + } + } + else { + return null; + } + } + + public static RevengDialect fromDialect(Dialect dialect) { + if(dialect!=null) { + if(dialect instanceof OracleDialect) { + return new OracleMetaDataDialect(); + } + else if (dialect instanceof H2Dialect) { + return new H2MetaDataDialect(); + } + else if (dialect instanceof MySQLDialect) { + return new MySQLMetaDataDialect(); + } + else if (dialect instanceof HSQLDialect) { + return new HSQLMetaDataDialect(); + } + else if (dialect instanceof SQLServerDialect) { + return new SQLServerMetaDataDialect(); + } + } + return null; + } + + public static RevengDialect fromDialectName(String dialect) { + if (dialect.toLowerCase().contains("oracle")) { + return new OracleMetaDataDialect(); + } + if (dialect.toLowerCase().contains("mysql")) { + return new MySQLMetaDataDialect(); + } + if (dialect.toLowerCase().contains("h2")) { + return new H2MetaDataDialect(); + } + if (dialect.toLowerCase().contains("hsql")) { + return new HSQLMetaDataDialect(); + } + if (dialect.toLowerCase().contains("sqlserver")) { + return new SQLServerMetaDataDialect(); + } + return null; + } } diff --git a/orm/src/main/java/org/hibernate/tool/api/reveng/RevengSettings.java b/orm/src/main/java/org/hibernate/tool/api/reveng/RevengSettings.java index f5a3fc99bb..a2268f6db6 100644 --- a/orm/src/main/java/org/hibernate/tool/api/reveng/RevengSettings.java +++ b/orm/src/main/java/org/hibernate/tool/api/reveng/RevengSettings.java @@ -19,92 +19,93 @@ public class RevengSettings { - - final RevengStrategy rootStrategy; - - private String defaultPackageName = ""; - private boolean detectOptimisticLock = true; - private boolean createCollectionForForeignKey = true; - private boolean createManyToOneForForeignKey = true; - private boolean detectManyToMany = true; - private boolean detectOneToOne = true; - - - public RevengSettings(RevengStrategy rootStrategy) { - this.rootStrategy = rootStrategy; - } - - public RevengSettings setDefaultPackageName(String defaultPackageName) { - if(defaultPackageName==null) { - this.defaultPackageName = ""; - } else { - this.defaultPackageName= defaultPackageName.trim(); - } - return this; - } - - /** return the default packageName. Never null, at least the empty string */ - public String getDefaultPackageName() { - return defaultPackageName; - } - - /** If true, reverse engineering strategy will try and autodetect columns for optimistc locking, e.g. VERSION and TIMESTAMP */ - public boolean getDetectOptimsticLock() { - return detectOptimisticLock ; - } - - public RevengSettings setDetectOptimisticLock( - boolean optimisticLockSupportEnabled) { - this.detectOptimisticLock = optimisticLockSupportEnabled; - return this; - } - - /** if true, a collection will be mapped for each foreignkey */ - public boolean createCollectionForForeignKey() { - return createCollectionForForeignKey; - } - - - public RevengSettings setCreateCollectionForForeignKey( - boolean createCollectionForForeignKey) { - this.createCollectionForForeignKey = createCollectionForForeignKey; - return this; - } - - /** if true, a many-to-one association will be created for each foreignkey found */ - public boolean createManyToOneForForeignKey() { - return createManyToOneForForeignKey; - } - - public RevengSettings setCreateManyToOneForForeignKey( - boolean createManyToOneForForeignKey) { - this.createManyToOneForForeignKey = createManyToOneForForeignKey; - return this; - } - - public RevengSettings setDetectManyToMany(boolean b) { - this.detectManyToMany = b; - return this; - } - - public boolean getDetectManyToMany() { - return detectManyToMany; - } - - public RevengSettings setDetectOneToOne(boolean b) { - this.detectOneToOne = b; - return this; - } - - public boolean getDetectOneToOne() { - return detectOneToOne; - } - - /** return the top/root strategy. Allows a lower strategy to ask another question. Be aware of possible recursive loops; e.g. do not call the root.tableToClassName in tableToClassName of a custom reversengineeringstrategy. */ - public RevengStrategy getRootStrategy() { - return rootStrategy; - } - - - + + final RevengStrategy rootStrategy; + + private String defaultPackageName = ""; + private boolean detectOptimisticLock = true; + private boolean createCollectionForForeignKey = true; + private boolean createManyToOneForForeignKey = true; + private boolean detectManyToMany = true; + private boolean detectOneToOne = true; + + + public RevengSettings(RevengStrategy rootStrategy) { + this.rootStrategy = rootStrategy; + } + + public RevengSettings setDefaultPackageName(String defaultPackageName) { + if(defaultPackageName==null) { + this.defaultPackageName = ""; + } + else { + this.defaultPackageName= defaultPackageName.trim(); + } + return this; + } + + /** return the default packageName. Never null, at least the empty string */ + public String getDefaultPackageName() { + return defaultPackageName; + } + + /** If true, reverse engineering strategy will try and autodetect columns for optimistc locking, e.g. VERSION and TIMESTAMP */ + public boolean getDetectOptimsticLock() { + return detectOptimisticLock ; + } + + public RevengSettings setDetectOptimisticLock( + boolean optimisticLockSupportEnabled) { + this.detectOptimisticLock = optimisticLockSupportEnabled; + return this; + } + + /** if true, a collection will be mapped for each foreignkey */ + public boolean createCollectionForForeignKey() { + return createCollectionForForeignKey; + } + + + public RevengSettings setCreateCollectionForForeignKey( + boolean createCollectionForForeignKey) { + this.createCollectionForForeignKey = createCollectionForForeignKey; + return this; + } + + /** if true, a many-to-one association will be created for each foreignkey found */ + public boolean createManyToOneForForeignKey() { + return createManyToOneForForeignKey; + } + + public RevengSettings setCreateManyToOneForForeignKey( + boolean createManyToOneForForeignKey) { + this.createManyToOneForForeignKey = createManyToOneForForeignKey; + return this; + } + + public RevengSettings setDetectManyToMany(boolean b) { + this.detectManyToMany = b; + return this; + } + + public boolean getDetectManyToMany() { + return detectManyToMany; + } + + public RevengSettings setDetectOneToOne(boolean b) { + this.detectOneToOne = b; + return this; + } + + public boolean getDetectOneToOne() { + return detectOneToOne; + } + + /** return the top/root strategy. Allows a lower strategy to ask another question. Be aware of possible recursive loops; e.g. do not call the root.tableToClassName in tableToClassName of a custom reversengineeringstrategy. */ + public RevengStrategy getRootStrategy() { + return rootStrategy; + } + + + } diff --git a/orm/src/main/java/org/hibernate/tool/api/reveng/RevengStrategyFactory.java b/orm/src/main/java/org/hibernate/tool/api/reveng/RevengStrategyFactory.java index d0025d3e3a..2804773dda 100644 --- a/orm/src/main/java/org/hibernate/tool/api/reveng/RevengStrategyFactory.java +++ b/orm/src/main/java/org/hibernate/tool/api/reveng/RevengStrategyFactory.java @@ -39,8 +39,8 @@ private static RuntimeException createExceptionBecauseOfMissingConstructors(Clas "'" + revengClass.getSimpleName() + "(" + RevengStrategy.class.getName() + ")'"); } - public static RevengStrategy createReverseEngineeringStrategy( - String revengClassName, RevengStrategy delegate) { + public static RevengStrategy createReverseEngineeringStrategy( + String revengClassName, RevengStrategy delegate) { if (revengClassName == null) { return delegate == null ? createDefaultStrategyInstance() : delegate; } @@ -53,15 +53,18 @@ public static RevengStrategy createReverseEngineeringStrategy( try { Constructor revengConstructor = revengClass.getConstructor(); return (RevengStrategy) revengConstructor.newInstance(); - } catch (NoSuchMethodException e1) { + } + catch (NoSuchMethodException e1) { try { Constructor revengConstructor = revengClass.getConstructor(RevengStrategy.class); return (RevengStrategy) revengConstructor.newInstance(createDefaultStrategyInstance()); - } catch (NoSuchMethodException e2) { + } + catch (NoSuchMethodException e2) { throw createExceptionBecauseOfMissingConstructors(revengClass); } } - } catch (IllegalAccessException | InstantiationException | InvocationTargetException | IllegalArgumentException e) { + } + catch (IllegalAccessException | InstantiationException | InvocationTargetException | IllegalArgumentException e) { throw new RuntimeException("A strategy of class '" + revengClassName + "' could not be created", e); } } @@ -70,25 +73,29 @@ public static RevengStrategy createReverseEngineeringStrategy( try { Constructor revengConstructor = revengClass.getConstructor(RevengStrategy.class); return (RevengStrategy) revengConstructor.newInstance(delegate); - } catch (NoSuchMethodException e1) { + } + catch (NoSuchMethodException e1) { log.warn("Delegating strategy given, but no matching constructor is available on class '" + revengClassName + "'. The delegating strategy will be ignored!"); try { Constructor revengConstructor = revengClass.getConstructor(); return (RevengStrategy) revengConstructor.newInstance(); - } catch (NoSuchMethodException e2) { + } + catch (NoSuchMethodException e2) { throw createExceptionBecauseOfMissingConstructors(revengClass); } } - } catch (IllegalAccessException | InstantiationException | InvocationTargetException | IllegalArgumentException e) { + } + catch (IllegalAccessException | InstantiationException | InvocationTargetException | IllegalArgumentException e) { throw new RuntimeException("A strategy of class '" + revengClassName + "' could not be created", e); } - } catch (ClassNotFoundException e) { + } + catch (ClassNotFoundException e) { throw new RuntimeException("A strategy of class '" + revengClassName + "' could not be created", e); } - } - - public static RevengStrategy createReverseEngineeringStrategy( String revengClassName, File[] revengFiles) { + } + + public static RevengStrategy createReverseEngineeringStrategy( String revengClassName, File[] revengFiles) { RevengStrategy result = null; if (revengFiles != null && revengFiles.length > 0) { OverrideRepository overrideRepository = new OverrideRepository(); @@ -98,14 +105,14 @@ public static RevengStrategy createReverseEngineeringStrategy( String revengClas result = overrideRepository.getReverseEngineeringStrategy(createDefaultStrategyInstance()); } - return createReverseEngineeringStrategy(revengClassName, result); - } + return createReverseEngineeringStrategy(revengClassName, result); + } public static RevengStrategy createReverseEngineeringStrategy(String revengClassName) { return createReverseEngineeringStrategy(revengClassName, (RevengStrategy) null); } - public static RevengStrategy createReverseEngineeringStrategy() { - return createDefaultStrategyInstance(); - } + public static RevengStrategy createReverseEngineeringStrategy() { + return createDefaultStrategyInstance(); + } } diff --git a/orm/src/main/java/org/hibernate/tool/api/xml/XMLPrettyPrinter.java b/orm/src/main/java/org/hibernate/tool/api/xml/XMLPrettyPrinter.java index ab76f8998d..a12b847a57 100644 --- a/orm/src/main/java/org/hibernate/tool/api/xml/XMLPrettyPrinter.java +++ b/orm/src/main/java/org/hibernate/tool/api/xml/XMLPrettyPrinter.java @@ -31,34 +31,35 @@ * */ public final class XMLPrettyPrinter { - - public static void prettyPrintFile(File file) throws IOException { - prettyPrintFile(file, null); - } - public static void prettyPrintFile(File file, XMLPrettyPrinterStrategy strategy) throws IOException { - String input = readFile(file.getAbsolutePath(), Charset.defaultCharset()); - String output = prettyFormat(input, strategy); - PrintWriter writer = new PrintWriter(file); - writer.print(output); - writer.flush(); - writer.close(); - } + public static void prettyPrintFile(File file) throws IOException { + prettyPrintFile(file, null); + } - private static String readFile(String path, Charset encoding) throws IOException { - byte[] encoded = Files.readAllBytes(Paths.get(path)); - return new String(encoded, encoding); - } + public static void prettyPrintFile(File file, XMLPrettyPrinterStrategy strategy) throws IOException { + String input = readFile(file.getAbsolutePath(), Charset.defaultCharset()); + String output = prettyFormat(input, strategy); + PrintWriter writer = new PrintWriter(file); + writer.print(output); + writer.flush(); + writer.close(); + } + + private static String readFile(String path, Charset encoding) throws IOException { + byte[] encoded = Files.readAllBytes(Paths.get(path)); + return new String(encoded, encoding); + } + + private static String prettyFormat(String input, XMLPrettyPrinterStrategy strategy) { + try { + if (strategy == null) { + strategy = XMLPrettyPrinterStrategyFactory.newXMLPrettyPrinterStrategy(); + } + return strategy.prettyPrint(input); + } + catch (Exception e) { + throw new RuntimeException(e); // simple exception handling, please review it + } + } - private static String prettyFormat(String input, XMLPrettyPrinterStrategy strategy) { - try { - if (strategy == null) { - strategy = XMLPrettyPrinterStrategyFactory.newXMLPrettyPrinterStrategy(); - } - return strategy.prettyPrint(input); - } catch (Exception e) { - throw new RuntimeException(e); // simple exception handling, please review it - } - } - } diff --git a/orm/src/main/java/org/hibernate/tool/internal/metadata/NativeMetadataDescriptor.java b/orm/src/main/java/org/hibernate/tool/internal/metadata/NativeMetadataDescriptor.java index cb2d0d2b1e..bc582d8117 100644 --- a/orm/src/main/java/org/hibernate/tool/internal/metadata/NativeMetadataDescriptor.java +++ b/orm/src/main/java/org/hibernate/tool/internal/metadata/NativeMetadataDescriptor.java @@ -28,44 +28,45 @@ import org.hibernate.tool.api.metadata.MetadataDescriptor; public class NativeMetadataDescriptor implements MetadataDescriptor { - - private Properties properties = new Properties(); - private MetadataSources metadataSources = null; - private StandardServiceRegistryBuilder ssrb = null; - - public NativeMetadataDescriptor( - File cfgXmlFile, - File[] mappingFiles, - Properties properties) { - BootstrapServiceRegistry bsr = new BootstrapServiceRegistryBuilder().build(); - ssrb = new StandardServiceRegistryBuilder(bsr); - if (cfgXmlFile != null) { - ssrb.configure(cfgXmlFile); - } - if (properties != null) { - this.properties.putAll(properties); - } - ssrb.applySettings(getProperties()); - metadataSources = new MetadataSources(bsr); - if (mappingFiles != null) { - for (File file : mappingFiles) { - if (file.getName().endsWith(".jar")) { - metadataSources.addJar(file); - } else { - metadataSources.addFile(file); - } - } - } - } - - public Properties getProperties() { - Properties result = new Properties(); - result.putAll(properties); - return result; - } - - public Metadata createMetadata() { - return metadataSources.buildMetadata(ssrb.build()); - } + + private final Properties properties = new Properties(); + private MetadataSources metadataSources = null; + private final StandardServiceRegistryBuilder ssrb; + + public NativeMetadataDescriptor( + File cfgXmlFile, + File[] mappingFiles, + Properties properties) { + BootstrapServiceRegistry bsr = new BootstrapServiceRegistryBuilder().build(); + ssrb = new StandardServiceRegistryBuilder(bsr); + if (cfgXmlFile != null) { + ssrb.configure(cfgXmlFile); + } + if (properties != null) { + this.properties.putAll(properties); + } + ssrb.applySettings(getProperties()); + metadataSources = new MetadataSources(bsr); + if (mappingFiles != null) { + for (File file : mappingFiles) { + if (file.getName().endsWith(".jar")) { + metadataSources.addJar(file); + } + else { + metadataSources.addFile(file); + } + } + } + } + + public Properties getProperties() { + Properties result = new Properties(); + result.putAll(properties); + return result; + } + + public Metadata createMetadata() { + return metadataSources.buildMetadata(ssrb.build()); + } } diff --git a/orm/src/main/java/org/hibernate/tool/internal/metadata/RevengMetadataDescriptor.java b/orm/src/main/java/org/hibernate/tool/internal/metadata/RevengMetadataDescriptor.java index 83bb152273..da6172d499 100644 --- a/orm/src/main/java/org/hibernate/tool/internal/metadata/RevengMetadataDescriptor.java +++ b/orm/src/main/java/org/hibernate/tool/internal/metadata/RevengMetadataDescriptor.java @@ -17,6 +17,7 @@ */ package org.hibernate.tool.internal.metadata; +import java.util.Objects; import java.util.Properties; import org.hibernate.boot.Metadata; @@ -28,37 +29,32 @@ import org.hibernate.tool.internal.reveng.RevengMetadataBuilder; public class RevengMetadataDescriptor implements MetadataDescriptor { - - private RevengStrategy reverseEngineeringStrategy = null; - private Properties properties = new Properties(); - public RevengMetadataDescriptor( - RevengStrategy reverseEngineeringStrategy, - Properties properties) { - this.properties.putAll(Environment.getProperties()); - if (properties != null) { - this.properties.putAll(properties); - } - if (reverseEngineeringStrategy != null) { - this.reverseEngineeringStrategy = reverseEngineeringStrategy; - } else { - this.reverseEngineeringStrategy = RevengStrategyFactory.createReverseEngineeringStrategy(); - } - if (this.properties.get(MetadataConstants.PREFER_BASIC_COMPOSITE_IDS) == null) { - this.properties.put(MetadataConstants.PREFER_BASIC_COMPOSITE_IDS, true); - } - } + private final RevengStrategy reverseEngineeringStrategy; + private final Properties properties = new Properties(); + + public RevengMetadataDescriptor( + RevengStrategy reverseEngineeringStrategy, + Properties properties) { + this.properties.putAll(Environment.getProperties()); + if (properties != null) { + this.properties.putAll(properties); + } + this.reverseEngineeringStrategy = Objects.requireNonNullElseGet( reverseEngineeringStrategy, + RevengStrategyFactory::createReverseEngineeringStrategy ); + this.properties.putIfAbsent( MetadataConstants.PREFER_BASIC_COMPOSITE_IDS, true ); + } + + public Properties getProperties() { + Properties result = new Properties(); + result.putAll(properties); + return result; + } + + public Metadata createMetadata() { + return RevengMetadataBuilder + .create(properties, reverseEngineeringStrategy) + .build(); + } - public Properties getProperties() { - Properties result = new Properties(); - result.putAll(properties); - return result; - } - - public Metadata createMetadata() { - return RevengMetadataBuilder - .create(properties, reverseEngineeringStrategy) - .build(); - } - } diff --git a/orm/src/main/java/org/hibernate/tool/internal/reveng/reader/IndexProcessor.java b/orm/src/main/java/org/hibernate/tool/internal/reveng/reader/IndexProcessor.java index 398c1d7b5b..c80b7475a2 100644 --- a/orm/src/main/java/org/hibernate/tool/internal/reveng/reader/IndexProcessor.java +++ b/orm/src/main/java/org/hibernate/tool/internal/reveng/reader/IndexProcessor.java @@ -136,11 +136,11 @@ public static void processIndices( } } - for ( Entry stringUniqueKeyEntry : uniquekeys.entrySet() ) { - // if keyset has no overlaps with primary key (table.getPrimaryKey()) - // if only key matches then mark as setNaturalId(true); - } - } +/* for ( Entry stringUniqueKeyEntry : uniquekeys.entrySet() ) { + // if keyset has no overlaps with primary key (table.getPrimaryKey()) + // if only key matches then mark as setNaturalId(true); + } +*/ } private static String getCatalogForDBLookup(String catalog, String defaultCatalog) { return catalog==null?defaultCatalog:catalog;