Browse files

Migrate to new libraries

  • Loading branch information...
1 parent b829f2f commit f97bebf69f8c347133cf98a7e0c68315959e5874 @dgeraskov dgeraskov committed Jan 27, 2012
Showing with 498 additions and 380 deletions.
  1. +1 −1 lib/testlibs/README.TXT
  2. BIN lib/testlibs/commons-collections-2.1.1.jar
  3. BIN lib/testlibs/commons-collections-3.1.jar
  4. BIN lib/testlibs/hibernate-commons-annotations-4.0.1.Final.jar
  5. BIN lib/testlibs/hibernate-core-4.0.0.Final.jar
  6. BIN lib/testlibs/hibernate-jpa-2.0-api-1.0.0.Final.jar
  7. BIN lib/testlibs/hibernate-jpa-2.0-api-1.0.1.Final.jar
  8. BIN lib/testlibs/hibernate3.jar
  9. +2 −15 lib/testlibs/version.properties
  10. +17 −15 pom.xml
  11. +27 −23 src/java/org/hibernate/cfg/JDBCBinder.java
  12. +42 −8 src/java/org/hibernate/cfg/JDBCMetaDataConfiguration.java
  13. +11 −7 src/java/org/hibernate/cfg/JDBCReaderFactory.java
  14. +1 −1 src/java/org/hibernate/cfg/MetaDataDialectFactory.java
  15. +1 −1 src/java/org/hibernate/cfg/reveng/DefaultDatabaseCollector.java
  16. +4 −4 src/java/org/hibernate/cfg/reveng/DefaultReverseEngineeringStrategy.java
  17. +6 −6 src/java/org/hibernate/cfg/reveng/JDBCReader.java
  18. +1 −1 src/java/org/hibernate/cfg/reveng/OverrideBinder.java
  19. +48 −22 src/java/org/hibernate/cfg/reveng/OverrideRepository.java
  20. +3 −2 src/java/org/hibernate/cfg/reveng/ReverseEngineeringRuntimeInfo.java
  21. +6 −6 src/java/org/hibernate/cfg/reveng/dialect/AbstractMetaDataDialect.java
  22. +0 −2 src/java/org/hibernate/cfg/reveng/dialect/CachedMetaDataDialect.java
  23. +2 −2 src/java/org/hibernate/cfg/reveng/dialect/H2MetaDataDialect.java
  24. +0 −2 src/java/org/hibernate/cfg/reveng/dialect/MetaDataDialect.java
  25. +1 −1 src/java/org/hibernate/cfg/reveng/dialect/OracleMetaDataDialect.java
  26. +2 −1 src/java/org/hibernate/cfg/reveng/dialect/ResultSetIterator.java
  27. +1 −1 src/java/org/hibernate/tool/ant/AnnotationConfigurationTask.java
  28. +1 −1 src/java/org/hibernate/tool/ant/ConfigurationTask.java
  29. +1 −1 src/java/org/hibernate/tool/ant/GenericExporterTask.java
  30. +1 −1 src/java/org/hibernate/tool/ant/HibernateToolTask.java
  31. +1 −1 src/java/org/hibernate/tool/ant/JDBCConfigurationTask.java
  32. +1 −1 src/java/org/hibernate/tool/ant/JPAConfigurationTask.java
  33. +1 −1 src/java/org/hibernate/tool/ant/QueryExporterTask.java
  34. +5 −5 src/java/org/hibernate/tool/hbm2x/AbstractExporter.java
  35. +5 −5 src/java/org/hibernate/tool/hbm2x/Cfg2HbmTool.java
  36. +9 −37 src/java/org/hibernate/tool/hbm2x/Cfg2JavaTool.java
  37. +3 −3 src/java/org/hibernate/tool/hbm2x/ConfigurationNavigator.java
  38. +1 −1 src/java/org/hibernate/tool/hbm2x/DocExporter.java
  39. +1 −1 src/java/org/hibernate/tool/hbm2x/ExporterProvider.java
  40. +1 −1 src/java/org/hibernate/tool/hbm2x/GenericExporter.java
  41. +17 −10 src/java/org/hibernate/tool/hbm2x/Hbm2DDLExporter.java
  42. +1 −1 src/java/org/hibernate/tool/hbm2x/HibernateMappingExporter.java
  43. +1 −1 src/java/org/hibernate/tool/hbm2x/HibernateMappingGlobalSettings.java
  44. +1 −1 src/java/org/hibernate/tool/hbm2x/QueryExporter.java
  45. +3 −3 src/java/org/hibernate/tool/hbm2x/TemplateHelper.java
  46. +3 −3 src/java/org/hibernate/tool/hbm2x/TemplateProducer.java
  47. +3 −3 src/java/org/hibernate/tool/hbm2x/XMLPrettyPrinter.java
  48. +10 −3 src/java/org/hibernate/tool/hbm2x/doc/DocHelper.java
  49. +1 −1 src/java/org/hibernate/tool/hbm2x/pojo/BasicPOJOClass.java
  50. +1 −1 src/java/org/hibernate/tool/hbm2x/pojo/ComponentPOJOClass.java
  51. +2 −2 src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java
  52. +1 −1 src/java/org/hibernate/tool/hbm2x/pojo/ImportContextImpl.java
  53. +6 −1 src/java/org/hibernate/tool/hbmlint/HbmLint.java
  54. +5 −16 src/java/org/hibernate/tool/hbmlint/detector/InstrumentationDetector.java
  55. +11 −4 src/java/org/hibernate/tool/hbmlint/detector/SchemaByMetaDataDetector.java
  56. +1 −1 src/java/org/hibernate/tool/ide/completion/AntlrSimpleHQLLexer.java
  57. +1 −1 src/java/org/hibernate/tool/ide/completion/HQLAnalyzer.java
  58. +1 −1 src/java/org/hibernate/tool/stat/StatisticsCellRenderer.java
  59. +2 −2 src/java/org/hibernate/tool/stat/StatisticsTreeModel.java
  60. +16 −7 src/test/org/hibernate/tool/BaseTestCase.java
  61. +14 −9 src/test/org/hibernate/tool/JDBCMetaDataBinderTestCase.java
  62. +10 −8 src/test/org/hibernate/tool/NonReflectiveTestCase.java
  63. +3 −3 src/test/org/hibernate/tool/ant/AntHibernateToolTest.java
  64. +9 −4 src/test/org/hibernate/tool/hbm2x/CachedMetaDataTest.java
  65. +11 −4 src/test/org/hibernate/tool/hbm2x/DefaultDatabaseCollectorTest.java
  66. +20 −12 src/test/org/hibernate/tool/hbm2x/DummyDateType.java
  67. +2 −6 src/test/org/hibernate/tool/hbm2x/GenerateFromJDBCTest.java
  68. +1 −1 src/test/org/hibernate/tool/hbm2x/Hbm2EJBDaoTest.java
  69. +1 −1 src/test/org/hibernate/tool/hbm2x/Hbm2HibernateDAOTest.java
  70. +2 −2 src/test/org/hibernate/tool/hbm2x/Hbm2JavaEjb3Test.java
  71. +9 −2 src/test/org/hibernate/tool/hbm2x/IncrementalSchemaReadingTest.java
  72. +1 −1 src/test/org/hibernate/tool/hbm2x/JdbcHbm2JavaEjb3Test.java
  73. +0 −1 src/test/org/hibernate/tool/hbm2x/OtherCfg2HbmTest.java
  74. +0 −1 src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Hbm2HbmXmlTest.java
  75. +0 −1 src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/ManyToManyTest.java
  76. +9 −2 src/test/org/hibernate/tool/hbm2x/query/QueryExporterTest.java
  77. +3 −15 src/test/org/hibernate/tool/hbmlint/FakeNonLazy.java
  78. +3 −1 src/test/org/hibernate/tool/hbmlint/HbmLintTest.java
  79. +6 −1 src/test/org/hibernate/tool/hbmlint/SchemaAnalyzerTest.java
  80. +13 −6 src/test/org/hibernate/tool/stat/StatisticsBrowserDemo.java
  81. +20 −8 src/test/org/hibernate/tool/test/DriverMetaDataTest.java
  82. +4 −4 src/test/org/hibernate/tool/test/TestHelper.java
  83. +1 −1 src/test/org/hibernate/tool/test/jdbc2cfg/CompositeIdTest.java
  84. +10 −5 src/test/org/hibernate/tool/test/jdbc2cfg/OneToOneTest.java
  85. +6 −1 src/test/org/hibernate/tool/test/jdbc2cfg/OverrideBinderTest.java
  86. +9 −4 src/test/org/hibernate/tool/test/jdbc2cfg/PerformanceTest.java
  87. +1 −1 src/test/org/hibernate/tool/test/jdbc2cfg/PersistentClassesTest.java
  88. +13 −5 src/test/org/hibernate/tool/test/jdbc2cfg/RevEngForeignKeyTests.java
  89. +3 −4 src/test5.0/org/hibernate/tool/hbm2x/Hbm2JavaEjb3ForJDK50Test.java
  90. +3 −4 src/test5.0/org/hibernate/tool/test/jdbc2cfg/CompositeIdJPATest.java
  91. +3 −4 src/test5.0/org/hibernate/tool/test/jdbc2cfg/ManyToManyJDK50Test.java
  92. +2 −2 src/test5.0/org/hibernate/tool/test/jdbc2cfg/VersioningForJDK50Test.java
  93. +0 −5 src/testresources/hibernate.properties
  94. +5 −2 src/testsupport/AnyKindOfUserType.java
  95. +3 −1 src/testsupport/DummyEntityResolver.java
  96. +2 −3 src/testsupport/HibernateTestAuto.java
  97. +2 −2 src/testsupport/anttest-build.xml
View
2 lib/testlibs/README.TXT
@@ -7,4 +7,4 @@ Jar files from JBoss 4.0.4.GA and jboss-seam-1.0.0.CR3
Warning: in order to run AntHibernateToolTest.testHbm2DDLExportExecution,testHbm2DDLLogic and testHbm2DDLUpdateExecution
you must have an up to date hibernate core jar in your classpath.
-In lib\testlibs, provided hibernate3.jar allows you to run these tests
+In lib\testlibs, provided hibernate-core-4.0.0.Final.jar allows you to run these tests
View
BIN lib/testlibs/commons-collections-2.1.1.jar
Binary file not shown.
View
BIN lib/testlibs/commons-collections-3.1.jar
Binary file not shown.
View
BIN lib/testlibs/hibernate-commons-annotations-4.0.1.Final.jar
Binary file not shown.
View
BIN lib/testlibs/hibernate-core-4.0.0.Final.jar
Binary file not shown.
View
BIN lib/testlibs/hibernate-jpa-2.0-api-1.0.0.Final.jar
Binary file not shown.
View
BIN lib/testlibs/hibernate-jpa-2.0-api-1.0.1.Final.jar
Binary file not shown.
View
BIN lib/testlibs/hibernate3.jar
Binary file not shown.
View
17 lib/testlibs/version.properties
@@ -1,4 +1,4 @@
-hibernate.lib=hibernate3.jar
+hibernate.lib=hibernate-core-4.0.0.Final.jar
hibernate.ignorecheck=true
ant.lib=ant-1.6.5.jar
@@ -57,20 +57,7 @@ javassist.version=3.4
javassist.name=Javassist bytecode generator
javassist.when=runtime, required if using 'javassist' bytecode provider
-cglib.lib=cglib-2.1.3.jar
-cglib.version=2.1.3
-cglib.name=CGLIB bytecode generator
-cglib.when=runtime, required if using 'cglib' bytecode provider
-
-asm.lib=asm.jar
-asm.name=ASM bytecode library
-asm.when=runtime, required if using 'cglib' bytecode provider
-
-asm-attrs.lib=asm-attrs.jar
-asm-attrs.name=ASM bytecode library
-asm-attrs.when=runtime, required if using 'cglib' bytecode provider
-
-commons-collections.lib=commons-collections-2.1.1.jar
+commons-collections.lib=commons-collections-3.1.jar
commons-collections.version=2.1.1
commons-collections.name=Commons Collections
commons-collections.when=runtime, required
View
32 pom.xml
@@ -51,8 +51,9 @@
</developers>
<properties>
- <hibernateversion>3.5.6-Final</hibernateversion>
+ <hibernateversion>4.0.0.Final</hibernateversion>
<hibernateJpaversion>1.0.0.Final</hibernateJpaversion>
+ <hibernateCommonsAnnotationsVersion>3.2.0.Final</hibernateCommonsAnnotationsVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Default settings for Database connection; to be overridden in db specific profiles -->
@@ -63,7 +64,7 @@
<jdbc.pass/>
<jdbc.driver.groupId>hsqldb</jdbc.driver.groupId>
<jdbc.driver.artifactId>hsqldb</jdbc.driver.artifactId>
- <jdbc.driver.jdbc.driver.version>1.8.0.2</jdbc.driver.jdbc.driver.version>
+ <jdbc.driver.jdbc.driver.version>1.8.0.10</jdbc.driver.jdbc.driver.version>
<!-- End of settings for Database connection -->
</properties>
@@ -82,8 +83,8 @@
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
- <artifactId>hibernate-annotations</artifactId>
- <version>${hibernateversion}</version>
+ <artifactId>hibernate-commons-annotations</artifactId>
+ <version>${hibernateCommonsAnnotationsVersion}</version>
<scope>compile</scope>
</dependency>
<dependency>
@@ -111,12 +112,6 @@
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>cglib</groupId>
- <artifactId>cglib</artifactId>
- <version>2.2</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
@@ -154,8 +149,8 @@
</dependency>
<dependency>
<groupId>org.eclipse.jdt</groupId>
- <artifactId>org.eclipse.jdt.core</artifactId>
- <version>3.2.0-v_671</version>
+ <artifactId>core</artifactId>
+ <version>3.2.0.666</version>
<scope>compile</scope>
</dependency>
<dependency>
@@ -196,6 +191,13 @@
<version>${jdbc.driver.jdbc.driver.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>antlr</groupId>
+ <artifactId>antlr</artifactId>
+ <version>2.7.7</version>
+ <type>jar</type>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
<build>
@@ -229,7 +231,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
- <include>**/*Test.java</include>
+ <include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
@@ -337,8 +339,8 @@
<includes>
<include>**/*.java</include>
</includes>
- <source>1.4</source>
- <target>1.4</target>
+ <source>1.5</source>
+ <target>1.5</target>
</configuration>
</plugin>
<plugin>
View
50 src/java/org/hibernate/cfg/JDBCBinder.java
@@ -16,8 +16,6 @@
import java.util.Properties;
import java.util.Set;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.DuplicateMappingException;
import org.hibernate.FetchMode;
import org.hibernate.MappingException;
@@ -28,9 +26,11 @@
import org.hibernate.cfg.reveng.MappingsDatabaseCollector;
import org.hibernate.cfg.reveng.ReverseEngineeringStrategy;
import org.hibernate.cfg.reveng.TableIdentifier;
-import org.hibernate.connection.ConnectionProvider;
-import org.hibernate.engine.Mapping;
-import org.hibernate.engine.Versioning;
+import org.hibernate.engine.internal.Versioning;
+import org.hibernate.engine.jdbc.spi.JdbcServices;
+import org.hibernate.engine.spi.Mapping;
+import org.hibernate.internal.util.StringHelper;
+import org.hibernate.internal.util.collections.JoinedIterator;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.Component;
@@ -48,11 +48,12 @@
import org.hibernate.mapping.Table;
import org.hibernate.mapping.ToOne;
import org.hibernate.mapping.Value;
+import org.hibernate.service.jdbc.connections.spi.ConnectionProvider;
+import org.hibernate.service.spi.Stoppable;
import org.hibernate.type.ForeignKeyDirection;
import org.hibernate.type.Type;
-import org.hibernate.type.TypeFactory;
-import org.hibernate.util.JoinedIterator;
-import org.hibernate.util.StringHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
@@ -63,7 +64,7 @@
private Settings settings;
private ConnectionProvider connectionProvider;
- private static final Log log = LogFactory.getLog(JDBCBinder.class);
+ private static final Logger log = LoggerFactory.getLogger(JDBCBinder.class);
private final Mappings mappings;
@@ -86,18 +87,21 @@ public JDBCBinder(JDBCMetaDataConfiguration cfg, Settings settings, Mappings map
*/
public void readFromDatabase(String catalog, String schema, Mapping mapping) {
- this.connectionProvider = settings.getConnectionProvider();
-
try {
DatabaseCollector collector = readDatabaseSchema(catalog, schema);
createPersistentClasses(collector, mapping); //move this to a different step!
}
catch (SQLException e) {
- throw settings.getSQLExceptionConverter().convert(e, "Reading from database", null);
+ JdbcServices jdbcServices = cfg.getServiceRegistry().getService(JdbcServices.class);
+ throw jdbcServices.getSqlExceptionHelper().convert(e, "Reading from database", null);
}
finally {
- if(connectionProvider!=null) connectionProvider.close();
+ JdbcServices jdbcServices = cfg.getServiceRegistry().getService(JdbcServices.class);
+ this.connectionProvider = jdbcServices.getConnectionProvider();
+ if ( connectionProvider instanceof Stoppable ) {
+ ( ( Stoppable ) connectionProvider ).stop();
+ }
}
}
@@ -115,7 +119,7 @@ public DatabaseCollector readDatabaseSchema(String catalog, String schema) throw
catalog = catalog!=null ? catalog : settings.getDefaultCatalogName();
schema = schema!=null ? schema : settings.getDefaultSchemaName();
- JDBCReader reader = JDBCReaderFactory.newJDBCReader(cfg.getProperties(),settings,revengStrategy);
+ JDBCReader reader = JDBCReaderFactory.newJDBCReader(cfg.getProperties(),settings,revengStrategy, cfg.getServiceRegistry());
DatabaseCollector dbs = new MappingsDatabaseCollector(mappings, reader.getMetaDataDialect());
reader.readDatabaseSchema(dbs, catalog, schema);
return dbs;
@@ -260,7 +264,7 @@ private Property bindOneToOne(PersistentClass rc, Table targetTable,
ForeignKey fk, Set processedColumns, boolean constrained, boolean inverseProperty) {
- OneToOne value = new OneToOne(targetTable, rc);
+ OneToOne value = new OneToOne(mappings, targetTable, rc);
value.setReferencedEntityName(revengStrategy
.tableToClassName(TableIdentifier.create(targetTable)));
@@ -309,7 +313,7 @@ private Property bindOneToOne(PersistentClass rc, Table targetTable,
* @param propName
*/
private Property bindManyToOne(String propertyName, boolean mutable, Table table, ForeignKey fk, Set processedColumns) {
- ManyToOne value = new ManyToOne(table);
+ ManyToOne value = new ManyToOne(mappings, table);
value.setReferencedEntityName( fk.getReferencedEntityName() );
Iterator columns = fk.getColumnIterator();
while ( columns.hasNext() ) {
@@ -407,7 +411,7 @@ private Property bindOneToMany(PersistentClass rc, ForeignKey foreignKey, Set pr
Table collectionTable = foreignKey.getTable();
- Collection collection = new org.hibernate.mapping.Set(rc); // MASTER TODO: allow overriding collection type
+ Collection collection = new org.hibernate.mapping.Set(mappings, rc); // MASTER TODO: allow overriding collection type
collection.setCollectionTable(collectionTable); // CHILD+
@@ -423,7 +427,7 @@ private Property bindOneToMany(PersistentClass rc, ForeignKey foreignKey, Set pr
if(manyToMany) {
- ManyToOne element = new ManyToOne( collection.getCollectionTable() );
+ ManyToOne element = new ManyToOne(mappings, collection.getCollectionTable() );
//TODO: find the other foreignkey and choose the other side.
Iterator foreignKeyIterator = foreignKey.getTable().getForeignKeyIterator();
List keys = new ArrayList();
@@ -449,7 +453,7 @@ private Property bindOneToMany(PersistentClass rc, ForeignKey foreignKey, Set pr
} else {
String tableToClassName = bindCollection( rc, foreignKey, null, collection );
- OneToMany oneToMany = new OneToMany( collection.getOwner() );
+ OneToMany oneToMany = new OneToMany(mappings, collection.getOwner() );
oneToMany.setReferencedEntityName( tableToClassName ); // Child
mappings.addSecondPass( new JDBCCollectionSecondPass(mappings, collection) );
@@ -468,7 +472,7 @@ private Property bindOneToMany(PersistentClass rc, ForeignKey foreignKey, Set pr
.getValue();
}
- SimpleValue keyValue = new DependantValue( collectionTable, referencedKeyValue );
+ SimpleValue keyValue = new DependantValue(mappings, collectionTable, referencedKeyValue );
//keyValue.setForeignKeyName("none"); // Avoid creating the foreignkey
//key.setCascadeDeleteEnabled( "cascade".equals( subnode.attributeValue("on-delete") ) );
Iterator columnIterator = foreignKey.getColumnIterator();
@@ -777,7 +781,7 @@ private Property bindBasicProperty(String propertyName, Table table, Column colu
}
private SimpleValue bindColumnToSimpleValue(Table table, Column column, Mapping mapping, boolean generatedIdentifier) {
- SimpleValue value = new SimpleValue(table);
+ SimpleValue value = new SimpleValue(mappings, table);
value.addColumn(column);
value.setTypeName(guessAndAlignType(table, column, mapping, generatedIdentifier));
return value;
@@ -825,7 +829,7 @@ private String guessAndAlignType(Table table, Column column, Mapping mapping, bo
column.getLength(), column.getPrecision(), column.getScale(), column.isNullable(), generatedIdentifier
);
- Type wantedType = TypeFactory.heuristicType(preferredHibernateType);
+ Type wantedType = mappings.getTypeResolver().heuristicType(preferredHibernateType);
if(wantedType!=null) {
int[] wantedSqlTypes = wantedType.sqlTypes(mapping);
@@ -865,7 +869,7 @@ private String typeCodeName(int sqlTypeCode) {
* @return
*/
private SimpleValue handleCompositeKey(RootClass rc, Set processedColumns, List keyColumns, Mapping mapping) {
- Component pkc = new Component(rc);
+ Component pkc = new Component(mappings, rc);
pkc.setMetaAttributes(Collections.EMPTY_MAP);
pkc.setEmbedded(false);
View
50 src/java/org/hibernate/cfg/JDBCMetaDataConfiguration.java
@@ -6,41 +6,74 @@
import java.util.Set;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.dom4j.Element;
import org.hibernate.MappingException;
import org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy;
import org.hibernate.cfg.reveng.ReverseEngineeringStrategy;
-import org.hibernate.engine.Mapping;
+import org.hibernate.engine.spi.Mapping;
import org.hibernate.id.factory.IdentifierGeneratorFactory;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.Table;
+import org.hibernate.service.ServiceRegistry;
+import org.hibernate.service.ServiceRegistryBuilder;
+import org.hibernate.service.internal.StandardServiceRegistryImpl;
import org.hibernate.type.Type;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* @author max
*
*/
public class JDBCMetaDataConfiguration extends Configuration {
- private static final Log log = LogFactory.getLog(JDBCMetaDataConfiguration.class);
+ private static final Logger log = LoggerFactory.getLogger(JDBCMetaDataConfiguration.class);
private ReverseEngineeringStrategy revEngStrategy = new DefaultReverseEngineeringStrategy();
-
+ private ServiceRegistry serviceRegistry = null;
protected void secondPassCompileForeignKeys(Table table, Set done)
throws MappingException {
super.secondPassCompileForeignKeys(table, done);
// TODO: doing nothing to avoid creating foreignkeys which is NOT actually in the database.
}
+ public JDBCMetaDataConfiguration(){
+
+ }
+
+ public ServiceRegistry getServiceRegistry(){
+ if(serviceRegistry == null){
+ serviceRegistry = new ServiceRegistryBuilder()
+ .applySettings(getProperties())
+ .buildServiceRegistry();
+ }
+ return serviceRegistry;
+ }
+
+ private void destroyServiceRegistry(){
+ if (serviceRegistry instanceof StandardServiceRegistryImpl) {
+ ( (StandardServiceRegistryImpl) serviceRegistry ).destroy();
+ }
+ serviceRegistry = null;
+ }
+
+ public Settings buildSettings() {
+ destroyServiceRegistry();
+ return buildSettings( getServiceRegistry() );
+ }
+ public Settings buildSettings(ServiceRegistry serviceRegistry) {
+ this.serviceRegistry = serviceRegistry;
+ return super.buildSettings(serviceRegistry);
+ }
public void readFromJDBC() {
- JDBCBinder binder = new JDBCBinder(this, buildSettings(), createMappings(),revEngStrategy);
+
+ JDBCBinder binder = new JDBCBinder(this, buildSettings(), createMappings(), revEngStrategy);
binder.readFromDatabase(null, null, buildMapping(this));
+
}
static private Mapping buildMapping(final Configuration cfg) {
@@ -95,8 +128,9 @@ public void setPreferBasicCompositeIds(boolean flag) {
}
protected void parseMappingElement(Element subelement, String name) {
- if(!ignoreconfigxmlmapppings ) {
- super.parseMappingElement(subelement, name);
+ if(!ignoreconfigxmlmapppings ) {
+ //FIXME the method is private
+ // super.parseMappingElement(subelement, name);
}
else {
log.info("Ignoring " + name + " mapping");
View
18 src/java/org/hibernate/cfg/JDBCReaderFactory.java
@@ -6,21 +6,25 @@
import org.hibernate.cfg.reveng.ReverseEngineeringStrategy;
import org.hibernate.cfg.reveng.dialect.MetaDataDialect;
import org.hibernate.dialect.Dialect;
+import org.hibernate.engine.jdbc.spi.JdbcServices;
+import org.hibernate.service.ServiceRegistry;
final public class JDBCReaderFactory {
public static JDBCReader newJDBCReader(Properties cfg, Settings settings,
- ReverseEngineeringStrategy revengStrategy) {
-
- MetaDataDialect mdd = newMetaDataDialect( settings.getDialect(), cfg );
+ ReverseEngineeringStrategy revengStrategy, ServiceRegistry serviceRegistry) {
+
+ MetaDataDialect mdd = newMetaDataDialect( serviceRegistry.getService(JdbcServices.class).getDialect(), cfg );
- return newJDBCReader( settings, revengStrategy, mdd );
+ return newJDBCReader( settings, revengStrategy, mdd, serviceRegistry);
}
- public static JDBCReader newJDBCReader(Settings settings, ReverseEngineeringStrategy revengStrategy, MetaDataDialect mdd) {
- return new JDBCReader( mdd, settings.getConnectionProvider(), settings
- .getSQLExceptionConverter(), settings.getDefaultCatalogName(), settings.getDefaultSchemaName(), revengStrategy );
+ public static JDBCReader newJDBCReader(Settings settings, ReverseEngineeringStrategy revengStrategy, MetaDataDialect mdd,
+ ServiceRegistry serviceRegistry) {
+ JdbcServices jdbcServices = serviceRegistry.getService(JdbcServices.class);
+ return new JDBCReader( mdd, jdbcServices.getConnectionProvider(), jdbcServices.getSqlExceptionHelper()
+ .getSqlExceptionConverter(), settings.getDefaultCatalogName(), settings.getDefaultSchemaName(), revengStrategy );
}
public static MetaDataDialect newMetaDataDialect(Dialect dialect, Properties cfg) {
View
2 src/java/org/hibernate/cfg/MetaDataDialectFactory.java
@@ -14,7 +14,7 @@
import org.hibernate.dialect.MySQLDialect;
import org.hibernate.dialect.Oracle8iDialect;
import org.hibernate.dialect.Oracle9Dialect;
-import org.hibernate.util.ReflectHelper;
+import org.hibernate.internal.util.ReflectHelper;
public class MetaDataDialectFactory {
View
2 src/java/org/hibernate/cfg/reveng/DefaultDatabaseCollector.java
@@ -8,7 +8,7 @@
import org.hibernate.cfg.reveng.dialect.MetaDataDialect;
import org.hibernate.mapping.Table;
-import org.hibernate.util.StringHelper;
+import org.hibernate.internal.util.StringHelper;
public class DefaultDatabaseCollector extends AbstractDatabaseCollector {
View
8 src/java/org/hibernate/cfg/reveng/DefaultReverseEngineeringStrategy.java
@@ -10,17 +10,17 @@
import java.util.Properties;
import java.util.Set;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.ForeignKey;
import org.hibernate.mapping.PrimaryKey;
import org.hibernate.mapping.Table;
-import org.hibernate.util.StringHelper;
+import org.hibernate.internal.util.StringHelper;
public class DefaultReverseEngineeringStrategy implements ReverseEngineeringStrategy {
- static final private Log log = LogFactory.getLog(DefaultReverseEngineeringStrategy.class);
+ static final private Logger log = LoggerFactory.getLogger(DefaultReverseEngineeringStrategy.class);
private static Set AUTO_OPTIMISTICLOCK_COLUMNS;
View
12 src/java/org/hibernate/cfg/reveng/JDBCReader.java
@@ -16,26 +16,26 @@
import java.util.Map;
import java.util.Set;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.hibernate.JDBCException;
import org.hibernate.MappingException;
import org.hibernate.cfg.JDBCBinderException;
import org.hibernate.cfg.reveng.dialect.MetaDataDialect;
-import org.hibernate.connection.ConnectionProvider;
-import org.hibernate.exception.SQLExceptionConverter;
+import org.hibernate.service.jdbc.connections.spi.ConnectionProvider;
+import org.hibernate.exception.spi.SQLExceptionConverter;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.ForeignKey;
import org.hibernate.mapping.Index;
import org.hibernate.mapping.PrimaryKey;
import org.hibernate.mapping.Table;
import org.hibernate.mapping.UniqueKey;
import org.hibernate.sql.Alias;
-import org.hibernate.util.StringHelper;
+import org.hibernate.internal.util.StringHelper;
public class JDBCReader {
- private static final Log log = LogFactory.getLog(JDBCReader.class);
+ private static final Logger log = LoggerFactory.getLogger(JDBCReader.class);
private final ReverseEngineeringStrategy revengStrategy;
View
2 src/java/org/hibernate/cfg/reveng/OverrideBinder.java
@@ -13,7 +13,7 @@
import org.hibernate.mapping.Column;
import org.hibernate.mapping.ForeignKey;
import org.hibernate.mapping.Table;
-import org.hibernate.util.StringHelper;
+import org.hibernate.internal.util.StringHelper;
public final class OverrideBinder {
View
70 src/java/org/hibernate/cfg/reveng/OverrideRepository.java
@@ -13,24 +13,21 @@
import java.util.Properties;
import java.util.Set;
-import net.sf.cglib.core.KeyFactory;
-
import org.apache.commons.collections.MultiMap;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.dom4j.Document;
import org.hibernate.MappingException;
+import org.hibernate.internal.util.StringHelper;
+import org.hibernate.internal.util.xml.XMLHelper;
import org.hibernate.mapping.ForeignKey;
-import org.hibernate.mapping.MetaAttribute;
import org.hibernate.mapping.Table;
-import org.hibernate.util.StringHelper;
-import org.hibernate.util.XMLHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
public class OverrideRepository {
- final private static Log log = LogFactory.getLog( OverrideRepository.class );
+ final private static Logger log = LoggerFactory.getLogger( OverrideRepository.class );
final private transient XMLHelper xmlHelper;
final private transient EntityResolver entityResolver;
@@ -293,7 +290,7 @@ public Map columnToMetaAttributes(TableIdentifier tableIdentifier, String column
}
public boolean excludeColumn(TableIdentifier identifier, String columnName) {
- return excludedColumns.contains(TABLECOLUMN_KEY_FACTORY.newInstance(identifier, columnName));
+ return excludedColumns.contains(new TableColumnKey(identifier, columnName));
}
public String tableToCompositeIdName(TableIdentifier identifier) {
@@ -323,7 +320,7 @@ public String columnToHibernateTypeName(TableIdentifier table, String columnName
location += " Column: " + columnName + info;
}
if(table!=null && columnName!=null) {
- result = (String) typeForColumn.get(TABLECOLUMN_KEY_FACTORY.newInstance(table, columnName));
+ result = (String) typeForColumn.get(new TableColumnKey(table, columnName));
if(result!=null) {
log.debug("explicit column mapping found for [" + location + "] to [" + result + "]");
return result;
@@ -377,7 +374,7 @@ public List getForeignKeys(TableIdentifier referencedTable) {
}
public String columnToPropertyName(TableIdentifier table, String column) {
- String result = (String) propertyNameForColumn.get(TABLECOLUMN_KEY_FACTORY.newInstance(table, column));
+ String result = (String) propertyNameForColumn.get(new TableColumnKey(table, column));
if(result==null) {
return super.columnToPropertyName(table, column);
} else {
@@ -496,7 +493,7 @@ public AssociationInfo foreignKeyToAssociationInfo(ForeignKey foreignKey) {
}
protected Map columnToMetaAttributes(TableIdentifier tableIdentifier, String column) {
- Map specific = (Map) columnMetaAttributes.get( TABLECOLUMN_KEY_FACTORY.newInstance(tableIdentifier, column) );
+ Map specific = (Map) columnMetaAttributes.get( new TableColumnKey(tableIdentifier, column) );
if(specific!=null && !specific.isEmpty()) {
return toMetaAttributes(specific);
}
@@ -583,29 +580,58 @@ public void addTable(Table table, String wantedClassName) {
}
}
+ static class TableColumnKey {
+ private TableIdentifier query;
+ private String name;
+
+ TableColumnKey(TableIdentifier query, String name){
+ this.query = query;
+ this.name = name;
+ }
- private static final TableColumnKeyFactory TABLECOLUMN_KEY_FACTORY;
- static {
- TABLECOLUMN_KEY_FACTORY = (TableColumnKeyFactory) KeyFactory.create(TableColumnKeyFactory.class);
- }
+ @Override
+ public int hashCode() {
+ final int prime = 29;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((query == null) ? 0 : query.hashCode());
+ return result;
+ }
- static interface TableColumnKeyFactory {
- Object newInstance(TableIdentifier query, String name);
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null) return false;
+ if (getClass() != obj.getClass()) return false;
+ TableColumnKey other = (TableColumnKey) obj;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ if (query == null) {
+ if (other.query != null)
+ return false;
+ } else if (!query.equals(other.query))
+ return false;
+ return true;
+ }
+
}
public void setTypeNameForColumn(TableIdentifier identifier, String columnName, String type) {
if(StringHelper.isNotEmpty(type)) {
- typeForColumn.put(TABLECOLUMN_KEY_FACTORY.newInstance(identifier, columnName), type);
+ typeForColumn.put(new TableColumnKey(identifier, columnName), type);
}
}
public void setExcludedColumn(TableIdentifier tableIdentifier, String columnName) {
- excludedColumns.add(TABLECOLUMN_KEY_FACTORY.newInstance(tableIdentifier, columnName));
+ excludedColumns.add(new TableColumnKey(tableIdentifier, columnName));
}
public void setPropertyNameForColumn(TableIdentifier identifier, String columnName, String property) {
if(StringHelper.isNotEmpty(property)) {
- propertyNameForColumn.put(TABLECOLUMN_KEY_FACTORY.newInstance(identifier, columnName), property);
+ propertyNameForColumn.put(new TableColumnKey(identifier, columnName), property);
}
}
@@ -678,7 +704,7 @@ public void addMetaAttributeInfo(Table table, Map map) {
public void addMetaAttributeInfo(TableIdentifier tableIdentifier, String name, MultiMap map) {
if(map!=null && !map.isEmpty()) {
- columnMetaAttributes.put(TABLECOLUMN_KEY_FACTORY.newInstance( tableIdentifier, name ), map);
+ columnMetaAttributes.put(new TableColumnKey( tableIdentifier, name ), map);
}
}
View
5 src/java/org/hibernate/cfg/reveng/ReverseEngineeringRuntimeInfo.java
@@ -1,8 +1,9 @@
package org.hibernate.cfg.reveng;
-import org.hibernate.connection.ConnectionProvider;
-import org.hibernate.exception.SQLExceptionConverter;
+
+import org.hibernate.exception.spi.SQLExceptionConverter;
import org.hibernate.mapping.Table;
+import org.hibernate.service.jdbc.connections.spi.ConnectionProvider;
/**
* Provides runtime-only information for reverse engineering process.
View
12 src/java/org/hibernate/cfg/reveng/dialect/AbstractMetaDataDialect.java
@@ -10,12 +10,12 @@
import java.util.List;
import java.util.Map;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.cfg.JDBCBinderException;
import org.hibernate.cfg.reveng.ReverseEngineeringRuntimeInfo;
-import org.hibernate.exception.SQLExceptionConverter;
-import org.hibernate.util.StringHelper;
+import org.hibernate.exception.spi.SQLExceptionConverter;
+import org.hibernate.internal.util.StringHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* abstract base class for the metadatadialects to hold the
@@ -24,9 +24,9 @@
* @author max
*
*/
-abstract public class AbstractMetaDataDialect implements MetaDataDialect {
+public abstract class AbstractMetaDataDialect implements MetaDataDialect {
- protected final Log log = LogFactory.getLog(this.getClass());
+ protected final Logger log = LoggerFactory.getLogger(this.getClass());
private Connection connection;
private DatabaseMetaData metaData;
View
2 src/java/org/hibernate/cfg/reveng/dialect/CachedMetaDataDialect.java
@@ -7,8 +7,6 @@
import java.util.Map;
import org.hibernate.cfg.reveng.ReverseEngineeringRuntimeInfo;
-import org.hibernate.connection.ConnectionProvider;
-import org.hibernate.exception.SQLExceptionConverter;
public class CachedMetaDataDialect implements MetaDataDialect {
View
4 src/java/org/hibernate/cfg/reveng/dialect/H2MetaDataDialect.java
@@ -7,8 +7,8 @@
import java.util.Iterator;
import java.util.Map;
-import org.hibernate.util.StringHelper;
-import org.hibernate.util.ReflectHelper;
+import org.hibernate.internal.util.StringHelper;
+import org.hibernate.internal.util.ReflectHelper;
/**
View
2 src/java/org/hibernate/cfg/reveng/dialect/MetaDataDialect.java
@@ -3,8 +3,6 @@
import java.util.Iterator;
import org.hibernate.cfg.reveng.ReverseEngineeringRuntimeInfo;
-import org.hibernate.connection.ConnectionProvider;
-import org.hibernate.exception.SQLExceptionConverter;
/**
* Interface for fetching metadata from databases.
View
2 src/java/org/hibernate/cfg/reveng/dialect/OracleMetaDataDialect.java
@@ -234,7 +234,7 @@ protected Object convertRow(ResultSet tableResultSet)
element.put("TABLE_CAT", null);
element.put("TABLE_TYPE", tableResultSet.getString(4));
element.put("REMARKS", tableResultSet.getString(3));
- log.info( element );
+ log.info( element.toString() );
return element;
}
View
3 src/java/org/hibernate/cfg/reveng/dialect/ResultSetIterator.java
@@ -6,7 +6,8 @@
import java.util.Iterator;
import java.util.NoSuchElementException;
-import org.hibernate.exception.SQLExceptionConverter;
+import org.hibernate.exception.spi.SQLExceptionConverter;
+
/**
* Iterator over a resultset; intended usage only for metadata reading.
View
2 src/java/org/hibernate/tool/ant/AnnotationConfigurationTask.java
@@ -6,7 +6,7 @@
import org.apache.tools.ant.BuildException;
import org.hibernate.cfg.Configuration;
-import org.hibernate.util.ReflectHelper;
+import org.hibernate.internal.util.ReflectHelper;
/**
* Class that uses reflection to load AnnotatioConfiguration.
View
2 src/java/org/hibernate/tool/ant/ConfigurationTask.java
@@ -22,7 +22,7 @@
import org.hibernate.HibernateException;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.NamingStrategy;
-import org.hibernate.util.ReflectHelper;
+import org.hibernate.internal.util.ReflectHelper;
import org.xml.sax.EntityResolver;
/**
View
2 src/java/org/hibernate/tool/ant/GenericExporterTask.java
@@ -7,7 +7,7 @@
import org.apache.tools.ant.BuildException;
import org.hibernate.tool.hbm2x.Exporter;
import org.hibernate.tool.hbm2x.GenericExporter;
-import org.hibernate.util.ReflectHelper;
+import org.hibernate.internal.util.ReflectHelper;
/**
* @author max
View
2 src/java/org/hibernate/tool/ant/HibernateToolTask.java
@@ -19,7 +19,7 @@
import org.apache.tools.ant.types.PropertySet;
import org.hibernate.MappingNotFoundException;
import org.hibernate.cfg.Configuration;
-import org.hibernate.util.StringHelper;
+import org.hibernate.internal.util.StringHelper;
/**
* @author max
View
2 src/java/org/hibernate/tool/ant/JDBCConfigurationTask.java
@@ -16,7 +16,7 @@
import org.hibernate.cfg.reveng.OverrideRepository;
import org.hibernate.cfg.reveng.ReverseEngineeringSettings;
import org.hibernate.cfg.reveng.ReverseEngineeringStrategy;
-import org.hibernate.util.ReflectHelper;
+import org.hibernate.internal.util.ReflectHelper;
/**
View
2 src/java/org/hibernate/tool/ant/JPAConfigurationTask.java
@@ -9,7 +9,7 @@
import org.apache.tools.ant.BuildException;
import org.hibernate.HibernateException;
import org.hibernate.cfg.Configuration;
-import org.hibernate.util.ReflectHelper;
+import org.hibernate.internal.util.ReflectHelper;
import org.xml.sax.EntityResolver;
public class JPAConfigurationTask extends ConfigurationTask {
View
2 src/java/org/hibernate/tool/ant/QueryExporterTask.java
@@ -7,7 +7,7 @@
import org.apache.tools.ant.BuildException;
import org.hibernate.tool.hbm2x.Exporter;
import org.hibernate.tool.hbm2x.QueryExporter;
-import org.hibernate.util.StringHelper;
+import org.hibernate.internal.util.StringHelper;
public class QueryExporterTask extends ExporterTask {
View
10 src/java/org/hibernate/tool/hbm2x/AbstractExporter.java
@@ -8,11 +8,11 @@
import java.util.Map;
import java.util.Properties;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.hibernate.cfg.Configuration;
-import org.hibernate.util.ReflectHelper;
-import org.hibernate.util.StringHelper;
+import org.hibernate.internal.util.ReflectHelper;
+import org.hibernate.internal.util.StringHelper;
/**
* Base exporter for the template and direct output generation.
@@ -22,7 +22,7 @@
*/
public abstract class AbstractExporter implements Exporter {
- protected Log log = LogFactory.getLog(this.getClass());
+ protected Logger log = LoggerFactory.getLogger(this.getClass());
private File outputdir;
private Configuration configuration;
View
10 src/java/org/hibernate/tool/hbm2x/Cfg2HbmTool.java
@@ -10,11 +10,11 @@
import org.hibernate.FetchMode;
import org.hibernate.cfg.Configuration;
-import org.hibernate.engine.Versioning;
-import org.hibernate.engine.query.sql.NativeSQLQueryCollectionReturn;
-import org.hibernate.engine.query.sql.NativeSQLQueryJoinReturn;
-import org.hibernate.engine.query.sql.NativeSQLQueryReturn;
-import org.hibernate.engine.query.sql.NativeSQLQueryRootReturn;
+import org.hibernate.engine.internal.Versioning;
+import org.hibernate.engine.query.spi.sql.NativeSQLQueryCollectionReturn;
+import org.hibernate.engine.query.spi.sql.NativeSQLQueryJoinReturn;
+import org.hibernate.engine.query.spi.sql.NativeSQLQueryReturn;
+import org.hibernate.engine.query.spi.sql.NativeSQLQueryRootReturn;
import org.hibernate.id.PersistentIdentifierGenerator;
import org.hibernate.mapping.Any;
import org.hibernate.mapping.Collection;
View
46 src/java/org/hibernate/tool/hbm2x/Cfg2JavaTool.java
@@ -4,20 +4,15 @@
*/
package org.hibernate.tool.hbm2x;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Hibernate;
import org.hibernate.cfg.reveng.ReverseEngineeringStrategyUtil;
+import org.hibernate.internal.util.StringHelper;
import org.hibernate.mapping.Array;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Component;
@@ -34,10 +29,12 @@
import org.hibernate.tool.hbm2x.pojo.NoopImportContext;
import org.hibernate.tool.hbm2x.pojo.POJOClass;
import org.hibernate.tool.hbm2x.visitor.JavaTypeFromValueVisitor;
+import org.hibernate.type.BasicTypeRegistry;
import org.hibernate.type.PrimitiveType;
import org.hibernate.type.Type;
-import org.hibernate.type.TypeFactory;
-import org.hibernate.util.StringHelper;
+import org.hibernate.type.TypeResolver;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Helper methods for javacode generation.
@@ -48,7 +45,7 @@
*/
public class Cfg2JavaTool {
- private static final Log log = LogFactory.getLog( Cfg2JavaTool.class );
+ private static final Logger log = LoggerFactory.getLogger( Cfg2JavaTool.class );
public Cfg2JavaTool() {
@@ -198,34 +195,9 @@ public String getJavaTypeName(Property p, boolean useGenerics, ImportContext imp
}
- private static Set NONPRIMITIVETYPES = null;
-
static public boolean isNonPrimitiveTypeName(String typeName) {
- if ( NONPRIMITIVETYPES == null ) {
- NONPRIMITIVETYPES = new HashSet();
- Field[] fields = Hibernate.class.getFields();
- for ( int i = 0; i < fields.length ; i++ ) {
- Field field = fields[i];
- if ( Modifier.isStatic( field.getModifiers() ) ) {
- if ( Type.class.isAssignableFrom( field.getType() ) ) {
- try {
- Type type = (Type) field.get( Hibernate.class );
- if ( !PRIMITIVES.containsKey( type.getName() ) ) {
- NONPRIMITIVETYPES.add( type.getName() );
- }
- }
- catch (IllegalArgumentException e) {
- throw new ExporterException( "Could not create list of basic hibernate types", e );
- }
- catch (IllegalAccessException e) {
- throw new ExporterException( "Could not create list of basic hibernate types", e );
- }
- }
- }
- }
- }
-
- return NONPRIMITIVETYPES.contains( typeName );
+ return (!PRIMITIVES.containsKey( typeName ))
+ && new BasicTypeRegistry().getRegisteredType(typeName) != null;
}
private String getRawTypeName(Property p, boolean useGenerics, boolean preferRawTypeNames, ImportContext importContext) {
@@ -373,7 +345,7 @@ public String asFinderArgumentList(Map parameterTypes, ImportContext ctx) {
Type type = null;
if(entry.getValue() instanceof String) {
try {
- type = TypeFactory.heuristicType((String) entry.getValue());
+ type = new TypeResolver().heuristicType((String) entry.getValue());
} catch(Throwable t) {
type = null;
typename = (String) entry.getValue();
View
6 src/java/org/hibernate/tool/hbm2x/ConfigurationNavigator.java
@@ -7,8 +7,8 @@
import java.util.Iterator;
import java.util.Map;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Component;
@@ -22,7 +22,7 @@
*/
public class ConfigurationNavigator {
- private static final Log log = LogFactory.getLog(POJOExporter.class);
+ private static final Logger log = LoggerFactory.getLogger(POJOExporter.class);
/**
* @param cfg
View
2 src/java/org/hibernate/tool/hbm2x/DocExporter.java
@@ -18,7 +18,7 @@
import org.hibernate.tool.hbm2x.doc.DocFileManager;
import org.hibernate.tool.hbm2x.doc.DocHelper;
import org.hibernate.tool.hbm2x.pojo.POJOClass;
-import org.hibernate.util.StringHelper;
+import org.hibernate.internal.util.StringHelper;
/**
* Exporter implementation that creates Hibernate Documentation.
View
2 src/java/org/hibernate/tool/hbm2x/ExporterProvider.java
@@ -6,7 +6,7 @@
import java.util.Properties;
import java.util.Set;
-import org.hibernate.util.ReflectHelper;
+import org.hibernate.internal.util.ReflectHelper;
public class ExporterProvider {
View
2 src/java/org/hibernate/tool/hbm2x/GenericExporter.java
@@ -13,7 +13,7 @@
import org.hibernate.mapping.PersistentClass;
import org.hibernate.tool.hbm2x.pojo.ComponentPOJOClass;
import org.hibernate.tool.hbm2x.pojo.POJOClass;
-import org.hibernate.util.StringHelper;
+import org.hibernate.internal.util.StringHelper;
public class GenericExporter extends AbstractExporter {
View
27 src/java/org/hibernate/tool/hbm2x/Hbm2DDLExporter.java
@@ -21,12 +21,12 @@
import java.lang.reflect.Method;
import java.util.Iterator;
-import org.hibernate.HibernateException;
-import org.hibernate.JDBCException;
import org.hibernate.cfg.Configuration;
+import org.hibernate.engine.jdbc.spi.JdbcServices;
+import org.hibernate.service.ServiceRegistry;
+import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.tool.hbm2ddl.SchemaExport;
import org.hibernate.tool.hbm2ddl.SchemaUpdate;
-import org.hibernate.util.ReflectHelper;
/**
* Schema Export (.ddl) code generation.
@@ -83,7 +83,9 @@ protected void doStart() {
final Configuration configuration = getConfiguration();
if (schemaUpdate) {
- SchemaUpdate update = new SchemaUpdate(configuration);
+ ServiceRegistryBuilder builder = new ServiceRegistryBuilder();
+ builder.applySettings(configuration.getProperties());
+ SchemaUpdate update = new SchemaUpdate(builder.buildServiceRegistry(), configuration);
// classic schemaupdate execution, will work with all releases
if(outputFileName == null && delimiter == null && haltOnError && format)
@@ -139,24 +141,28 @@ protected void doStart() {
} catch (NoSuchMethodException e) {
log.error( "Error during DDL export, this version of hibernate doesn't support following " +
"SchemaUpdate parameters: haltonerror = true, format= true, delimiter and outputfilename" +
- " either update hibernate3.jar or don't used the involved parameters", e );
+ " either update hibernate jar or don't used the involved parameters", e );
} catch (IllegalArgumentException e) {
log.error( "Error during DDL export, this version of hibernate doesn't support following " +
"SchemaUpdate parameters: haltonerror = true, format= true, delimiter and outputfilename" +
- " either update hibernate3.jar or don't used the involved parameters", e );
+ " either update hibernate jar or don't used the involved parameters", e );
} catch (InvocationTargetException e) {
log.error( "Error during DDL export, this version of hibernate doesn't support following " +
"SchemaUpdate parameters: haltonerror = true, format= true, delimiter and outputfilename" +
- " either update hibernate3.jar or don't used the involved parameters", e );
+ " either update hibernate jar or don't used the involved parameters", e );
} catch (IllegalAccessException e) {
log.error( "Error during DDL export, this version of hibernate doesn't support following " +
"SchemaUpdate parameters: haltonerror = true, format= true, delimiter and outputfilename" +
- " either update hibernate3.jar or don't used the involved parameters", e );
+ " either update hibernate jar or don't used the involved parameters", e );
}
}
} else {
- SchemaExport export = new SchemaExport(configuration);
+ ServiceRegistryBuilder builder = new ServiceRegistryBuilder();
+ builder.applySettings(configuration.getProperties());
+ ServiceRegistry serviceRegistry = builder.buildServiceRegistry();
+ serviceRegistry.getService( JdbcServices.class );
+ SchemaExport export = new SchemaExport(serviceRegistry, configuration);
if (null != outputFileName) {
export.setOutputFile(new File(getOutputDirectory(),
outputFileName).toString());
@@ -167,7 +173,8 @@ protected void doStart() {
export.setHaltOnError(haltOnError);
export.setFormat(format);
if (drop && create) {
- export.create(scriptToConsole, exportToDatabase);
+ // not just drop or create but both!
+ export.execute(scriptToConsole, exportToDatabase, false, false);
} else {
export.execute(scriptToConsole, exportToDatabase, drop, create);
}
View
2 src/java/org/hibernate/tool/hbm2x/HibernateMappingExporter.java
@@ -10,7 +10,7 @@
import org.hibernate.cfg.Configuration;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.tool.hbm2x.pojo.POJOClass;
-import org.hibernate.util.StringHelper;
+import org.hibernate.internal.util.StringHelper;
/**
* @author david and max
View
2 src/java/org/hibernate/tool/hbm2x/HibernateMappingGlobalSettings.java
@@ -4,7 +4,7 @@
*/
package org.hibernate.tool.hbm2x;
-import org.hibernate.util.StringHelper;
+import org.hibernate.internal.util.StringHelper;
/**
* This class replicates the global settings that can be selected
View
2 src/java/org/hibernate/tool/hbm2x/QueryExporter.java
@@ -10,7 +10,7 @@
import org.hibernate.HibernateException;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
-import org.hibernate.classic.Session;
+import org.hibernate.Session;
/**
* exporter for query execution.
View
6 src/java/org/hibernate/tool/hbm2x/TemplateHelper.java
@@ -16,8 +16,8 @@
import java.util.Date;
import java.util.List;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.hibernate.tool.Version;
import freemarker.cache.ClassTemplateLoader;
@@ -45,7 +45,7 @@
*/
public class TemplateHelper {
- static final Log log = LogFactory.getLog(TemplateHelper.class);
+ static final Logger log = LoggerFactory.getLogger(TemplateHelper.class);
private String templatePrefix;
private File outputDirectory;
View
6 src/java/org/hibernate/tool/hbm2x/TemplateProducer.java
@@ -8,13 +8,13 @@
import java.util.Iterator;
import java.util.Map;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class TemplateProducer {
- private static final Log log = LogFactory.getLog(TemplateProducer.class);
+ private static final Logger log = LoggerFactory.getLogger(TemplateProducer.class);
private final TemplateHelper th;
private ArtifactCollector ac;
View
6 src/java/org/hibernate/tool/hbm2x/XMLPrettyPrinter.java
@@ -19,8 +19,8 @@
import java.io.Writer;
import java.util.Properties;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.w3c.tidy.Tidy;
/**
@@ -29,7 +29,7 @@
*/
public final class XMLPrettyPrinter {
- private static final Log log = LogFactory.getLog( XMLPrettyPrinter.class );
+ private static final Logger log = LoggerFactory.getLogger( XMLPrettyPrinter.class );
private XMLPrettyPrinter() {
// noop
View
13 src/java/org/hibernate/tool/hbm2x/doc/DocHelper.java
@@ -12,12 +12,15 @@
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Settings;
import org.hibernate.dialect.Dialect;
+import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.Component;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.Table;
import org.hibernate.mapping.Value;
+import org.hibernate.service.ServiceRegistry;
+import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.tool.hbm2x.Cfg2JavaTool;
import org.hibernate.tool.hbm2x.ConfigurationNavigator;
import org.hibernate.tool.hbm2x.pojo.ComponentPOJOClass;
@@ -132,9 +135,13 @@ public DocHelper(Configuration cfg, Cfg2JavaTool cfg2JavaTool) {
this.cfg = cfg;
- dialect = cfg.buildSettings().getDialect(); // TODO: get it from somewhere "cached".
-
- Settings settings = cfg.buildSettings();
+ ServiceRegistryBuilder builder = new ServiceRegistryBuilder();
+ builder.applySettings(cfg.getProperties());
+ ServiceRegistry serviceRegistry = builder.buildServiceRegistry();
+ JdbcServices jdbcServices = serviceRegistry.getService(JdbcServices.class);
+ Settings settings = cfg.buildSettings(serviceRegistry);
+
+ dialect = jdbcServices.getDialect(); // TODO: get it from somewhere "cached".
String defaultCatalog = settings.getDefaultCatalogName();
View
2 src/java/org/hibernate/tool/hbm2x/pojo/BasicPOJOClass.java
@@ -28,7 +28,7 @@
import org.hibernate.tool.hbm2x.MetaAttributeConstants;
import org.hibernate.tool.hbm2x.MetaAttributeHelper;
import org.hibernate.tool.hbm2x.visitor.DefaultValueVisitor;
-import org.hibernate.util.StringHelper;
+import org.hibernate.internal.util.StringHelper;
/**
* Abstract implementation of POJOClass. To be extended by ComponentPOJO and EntityPOJO
View
2 src/java/org/hibernate/tool/hbm2x/pojo/ComponentPOJOClass.java
@@ -8,7 +8,7 @@
import org.hibernate.mapping.Component;
import org.hibernate.mapping.Property;
import org.hibernate.tool.hbm2x.Cfg2JavaTool;
-import org.hibernate.util.CollectionHelper;
+import org.hibernate.internal.util.collections.CollectionHelper;
public class ComponentPOJOClass extends BasicPOJOClass {
View
4 src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java
@@ -33,8 +33,8 @@
import org.hibernate.mapping.Value;
import org.hibernate.tool.hbm2x.Cfg2JavaTool;
import org.hibernate.type.ForeignKeyDirection;
-import org.hibernate.util.JoinedIterator;
-import org.hibernate.util.StringHelper;
+import org.hibernate.internal.util.collections.JoinedIterator;
+import org.hibernate.internal.util.StringHelper;
public class EntityPOJOClass extends BasicPOJOClass {
View
2 src/java/org/hibernate/tool/hbm2x/pojo/ImportContextImpl.java
@@ -6,7 +6,7 @@
import java.util.Set;
import java.util.TreeSet;
-import org.hibernate.util.StringHelper;
+import org.hibernate.internal.util.StringHelper;
public class ImportContextImpl implements ImportContext {
View
7 src/java/org/hibernate/tool/hbmlint/HbmLint.java
@@ -5,6 +5,8 @@
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Settings;
+import org.hibernate.service.ServiceRegistry;
+import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.tool.hbmlint.detector.BadCachingDetector;
import org.hibernate.tool.hbmlint.detector.InstrumentationDetector;
import org.hibernate.tool.hbmlint.detector.SchemaByMetaDataDetector;
@@ -23,7 +25,10 @@ public HbmLint(Detector[] detectors) {
public void analyze(Configuration cfg) {
- Settings settings = cfg.buildSettings();
+ ServiceRegistryBuilder builder = new ServiceRegistryBuilder();
+ builder.applySettings(cfg.getProperties());
+ ServiceRegistry serviceRegistry = builder.buildServiceRegistry();
+ Settings settings = cfg.buildSettings(serviceRegistry);
for (int i = 0; i < detectors.length; i++) {
detectors[i].initialize( cfg, settings );
View
21 src/java/org/hibernate/tool/hbmlint/detector/InstrumentationDetector.java
@@ -1,7 +1,7 @@
package org.hibernate.tool.hbmlint.detector;
import org.hibernate.MappingException;
-import org.hibernate.bytecode.cglib.BytecodeProviderImpl;
+import org.hibernate.bytecode.internal.javassist.BytecodeProviderImpl;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.cfg.Settings;
@@ -14,18 +14,13 @@
public String getName() {
return "instrument";
}
- private boolean cglibEnabled;
+
private boolean javassistEnabled;
public void initialize(Configuration cfg, Settings settings) {
super.initialize( cfg, settings );
- cglibEnabled = false;
- javassistEnabled = false;
-
if(Environment.getBytecodeProvider() instanceof BytecodeProviderImpl) {
- cglibEnabled = true;
- } else if(Environment.getBytecodeProvider() instanceof org.hibernate.bytecode.javassist.BytecodeProviderImpl) {
javassistEnabled = true;
}
}
@@ -53,23 +48,17 @@ public void visit(Configuration cfg, PersistentClass clazz, IssueCollector colle
return;
}
- } else if(cglibEnabled || javassistEnabled){
+ } else if(javassistEnabled){
Class[] interfaces = mappedClass.getInterfaces();
- boolean cglib = false;
boolean javaassist = false;
for (int i = 0; i < interfaces.length; i++) {
Class intface = interfaces[i];
- if(intface.getName().equals( "net.sf.cglib.transform.impl.InterceptFieldEnabled" )) {
- cglib = true;
- } else if(intface.getName().equals( "org.hibernate.bytecode.javassist.FieldHandled" )) {
+ if(intface.getName().equals( "org.hibernate.bytecode.internal.javassist.FieldHandled" )) {
javaassist = true;
}
}
- if(cglibEnabled && !cglib) {
- collector.reportIssue( new Issue("LAZY_NOT_INSTRUMENTED", Issue.HIGH_PRIORITY, "'" + clazz.getEntityName() + "' has lazy='false', but its class '" + mappedClass.getName() + "' has not been instrumented with cglib") );
- return;
- } else if (javassistEnabled && !javaassist) {
+ if (javassistEnabled && !javaassist) {
collector.reportIssue( new Issue("LAZY_NOT_INSTRUMENTED", Issue.HIGH_PRIORITY, "'" + clazz.getEntityName() + "' has lazy='false', but its class '" + mappedClass.getName() + "' has not been instrumented with javaassist") );
return;
} else {
View
15 src/java/org/hibernate/tool/hbmlint/detector/SchemaByMetaDataDetector.java
@@ -18,18 +18,21 @@
import org.hibernate.cfg.reveng.JDBCToHibernateTypeHelper;
import org.hibernate.cfg.reveng.SchemaSelection;
import org.hibernate.dialect.Dialect;
-import org.hibernate.engine.Mapping;
+import org.hibernate.engine.jdbc.spi.JdbcServices;
+import org.hibernate.engine.spi.Mapping;
import org.hibernate.id.IdentifierGenerator;
import org.hibernate.id.PersistentIdentifierGenerator;
+import org.hibernate.internal.util.StringHelper;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.IdentifierCollection;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.RootClass;
import org.hibernate.mapping.Table;
+import org.hibernate.service.ServiceRegistry;
+import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.tool.hbmlint.Issue;
import org.hibernate.tool.hbmlint.IssueCollector;
-import org.hibernate.util.StringHelper;
public class SchemaByMetaDataDetector extends RelationalModelDetector {
@@ -56,12 +59,16 @@ public SchemaByMetaDataDetector() {
public void initialize(Configuration cfg, Settings settings) {
super.initialize( cfg, settings );
- dialect = settings.getDialect();
+ ServiceRegistryBuilder builder = new ServiceRegistryBuilder();
+ builder.applySettings(cfg.getProperties());
+ ServiceRegistry serviceRegistry = builder.buildServiceRegistry();
+
+ dialect = serviceRegistry.getService(JdbcServices.class).getDialect();
tableSelector = new TableSelectorStrategy(
new DefaultReverseEngineeringStrategy() );
reader = JDBCReaderFactory.newJDBCReader( cfg.getProperties(),
- settings, tableSelector );
+ settings, tableSelector, serviceRegistry);
dbc = new DefaultDatabaseCollector(reader.getMetaDataDialect());
mapping = cfg.buildMapping();
}
View
2 src/java/org/hibernate/tool/ide/completion/AntlrSimpleHQLLexer.java
@@ -2,7 +2,7 @@
import java.io.CharArrayReader;
-import org.hibernate.hql.antlr.HqlBaseLexer;
+import org.hibernate.hql.internal.antlr.HqlBaseLexer;
import antlr.Token;
import antlr.TokenStreamException;
View
2 src/java/org/hibernate/tool/ide/completion/HQLAnalyzer.java
@@ -9,7 +9,7 @@
import java.util.Map;
import java.util.StringTokenizer;
-import org.hibernate.hql.antlr.HqlSqlTokenTypes;
+import org.hibernate.hql.internal.antlr.HqlSqlTokenTypes;
/**
* The HQLAnalyzer can answer certain questions about a HQL String.
View
2 src/java/org/hibernate/tool/stat/StatisticsCellRenderer.java
@@ -8,7 +8,7 @@
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;
-import org.hibernate.stat.CategorizedStatistics;
+import org.hibernate.stat.internal.CategorizedStatistics;
import org.hibernate.stat.CollectionStatistics;
import org.hibernate.stat.EntityStatistics;
import org.hibernate.stat.QueryStatistics;
View
4 src/java/org/hibernate/tool/stat/StatisticsTreeModel.java
@@ -4,7 +4,7 @@
import org.hibernate.stat.SecondLevelCacheStatistics;
import org.hibernate.stat.Statistics;
-import org.hibernate.util.IdentityMap;
+import org.hibernate.internal.util.collections.IdentityMap;
public class StatisticsTreeModel extends AbstractTreeModel {
@@ -15,7 +15,7 @@
String collections = "Collections";
String secondlevelcache = "Cache";
- Map im = IdentityMap.instantiate( 10 );
+ Map im = IdentityMap.instantiateSequenced( 10 );
public StatisticsTreeModel(Statistics stats) {
this.stats = stats;
View
23 src/test/org/hibernate/tool/BaseTestCase.java
@@ -15,8 +15,6 @@
import junit.framework.ComparisonFailure;
import junit.framework.TestCase;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.io.SAXReader;
@@ -26,7 +24,12 @@
import org.hibernate.cfg.reveng.ReverseEngineeringRuntimeInfo;
import org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect;
import org.hibernate.dialect.Dialect;
+import org.hibernate.engine.jdbc.spi.JdbcServices;
+import org.hibernate.service.ServiceRegistry;
+import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.tool.test.TestHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public abstract class BaseTestCase extends TestCase {
@@ -85,7 +88,7 @@ public URLClassLoader getUcl() {
}
- protected static final Log SKIP_LOG = LogFactory.getLog("org.hibernate.tool.test.SKIPPED");
+ protected static final Logger SKIP_LOG = LoggerFactory.getLogger("org.hibernate.tool.test.SKIPPED");
private File outputdir;
@@ -143,21 +146,27 @@ protected File getOutputDir() {
public void assertNoTables() throws SQLException {
Configuration configuration = new Configuration();
- Settings testSettings = configuration.buildSettings();
+ ServiceRegistryBuilder builder = new ServiceRegistryBuilder();
+ builder.applySettings(configuration.getProperties());
+ ServiceRegistry serviceRegistry = builder.buildServiceRegistry();
+
+ Settings testSettings = configuration.buildSettings(serviceRegistry);
+
+ JdbcServices jdbcServices = serviceRegistry.getService(JdbcServices.class);
Connection con = null;
try {
- con = testSettings.getConnectionProvider().getConnection();
+ con = jdbcServices.getConnectionProvider().getConnection();
JDBCMetaDataDialect dialect = new JDBCMetaDataDialect();
- dialect.configure( ReverseEngineeringRuntimeInfo.createInstance(testSettings.getConnectionProvider(), testSettings.getSQLExceptionConverter(), new DefaultDatabaseCollector(dialect)));
+ dialect.configure( ReverseEngineeringRuntimeInfo.createInstance(jdbcServices.getConnectionProvider(), jdbcServices.getSqlExceptionHelper().getSqlExceptionConverter(), new DefaultDatabaseCollector(dialect)));
Iterator tables = dialect.getTables( testSettings.getDefaultCatalogName(), testSettings.getDefaultSchemaName(), null );
assertHasNext( 0, tables );
} finally {
- testSettings.getConnectionProvider().closeConnection(con);
+ jdbcServices.getConnectionProvider().closeConnection(con);
}
}
View
23 src/test/org/hibernate/tool/JDBCMetaDataBinderTestCase.java
@@ -10,22 +10,24 @@
import java.sql.Statement;
import java.util.Iterator;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.JDBCMetaDataConfiguration;
-import org.hibernate.cfg.Settings;
import org.hibernate.cfg.reveng.TableIdentifier;
+import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.mapping.ForeignKey;
import org.hibernate.mapping.Table;
+import org.hibernate.service.ServiceRegistry;
+import org.hibernate.service.ServiceRegistryBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* @author max
*
*/
public abstract class JDBCMetaDataBinderTestCase extends BaseTestCase {
- private Log log = LogFactory.getLog( this.getClass() );
+ private Logger log = LoggerFactory.getLogger( this.getClass() );
public JDBCMetaDataBinderTestCase() {
super( null );
@@ -71,18 +73,21 @@ protected void assertEqualIdentifiers(String expected, String actual) {
*/
protected void executeDDL(String[] sqls, boolean ignoreErrors) throws SQLException {
Configuration configuration = new Configuration();
- Settings testSettings = configuration.buildSettings();
+ ServiceRegistryBuilder builder = new ServiceRegistryBuilder();
+ builder.applySettings(configuration.getProperties());
+ ServiceRegistry serviceRegistry = builder.buildServiceRegistry();
+ JdbcServices jdbcServices = serviceRegistry.getService(JdbcServices.class);
- if(!appliesTo( testSettings.getDialect() )) {
- fail("test case does not apply to " + testSettings.getDialect());
+ if(!appliesTo( jdbcServices.getDialect() )) {
+ fail("test case does not apply to " + jdbcServices.getDialect());
return; // don't do anything to avoid crippled db
}
Statement statement = null;
Connection con = null;
try {
- con = testSettings.getConnectionProvider().getConnection();
+ con = jdbcServices.getConnectionProvider().getConnection();
DatabaseMetaData metaData = con.getMetaData();
storesLowerCaseIdentifiers = metaData.storesLowerCaseIdentifiers();
@@ -112,7 +117,7 @@ protected void executeDDL(String[] sqls, boolean ignoreErrors) throws SQLExcepti
con.commit();
} finally {
if (statement!=null) statement.close();
- testSettings.getConnectionProvider().closeConnection(con);
+ jdbcServices.getConnectionProvider().closeConnection(con);