[hibernate-commits] Hibernate SVN: r15985 - in branches/Branch_3_2/HibernateExt/tools: src/java/org/hibernate/cfg/reveng and 6 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Tue Feb 17 06:06:07 EST 2009


Author: max.andersen at jboss.com
Date: 2009-02-17 06:06:06 -0500 (Tue, 17 Feb 2009)
New Revision: 15985

Added:
   branches/Branch_3_2/HibernateExt/tools/src/testsupport/querytest.hbm.xml
Modified:
   branches/Branch_3_2/HibernateExt/tools/.classpath
   branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/DefaultReverseEngineeringStrategy.java
   branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/ant/ConfigurationTask.java
   branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ant/AntHibernateToolTest.java
   branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/GenericExporterTest.java
   branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Hbm2HbmXmlTest.java
   branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/ManyToManyTest.java
   branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/OneToOneTest.java
   branches/Branch_3_2/HibernateExt/tools/src/testsupport/anttest-build.xml
   branches/Branch_3_2/HibernateExt/tools/src/testsupport/querytest-hibernate.cfg.xml
Log:
HBX-1108 don't ignore properties in cfg.xml just because properties are specified
HBX-1103 many-to-many detection did not check if the keys were part of the primary key as a whole

Fixed various issues in tests affected by changed ordering of classes and properties inside hibernate core.

Modified: branches/Branch_3_2/HibernateExt/tools/.classpath
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/.classpath	2009-02-17 10:29:05 UTC (rev 15984)
+++ branches/Branch_3_2/HibernateExt/tools/.classpath	2009-02-17 11:06:06 UTC (rev 15985)
@@ -1,35 +1,67 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="src" path="src/java"/>
-	<classpathentry kind="src" path="src/test"/>
-	<classpathentry kind="src" path="src/testsupport"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry kind="lib" path="lib/freemarker.jar"/>
-	<classpathentry kind="lib" path="lib/jtidy-r8-20060801.jar"/>
-	<classpathentry kind="lib" path="lib/org.eclipse.core.runtime_3.2.0.v20060603.jar"/>
-	<classpathentry kind="lib" path="lib/org.eclipse.equinox.common_3.2.0.v20060603.jar"/>
-	<classpathentry kind="lib" path="lib/org.eclipse.jdt.core_3.2.0.v_671.jar"/>
-	<classpathentry kind="lib" path="lib/org.eclipse.text_3.2.0.v20060605-1400.jar"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
-	<classpathentry combineaccessrules="false" kind="src" path="/hibernate-3.2"/>
-	<classpathentry kind="lib" path="/hibernate-3.2/lib/commons-logging-1.0.4.jar"/>
-	<classpathentry kind="lib" path="/hibernate-3.2/lib/dom4j-1.6.1.jar"/>
-	<classpathentry kind="lib" path="/hibernate-3.2/lib/ant-1.6.5.jar"/>
-	<classpathentry kind="lib" path="/hibernate-3.2/lib/antlr-2.7.6.jar"/>
-	<classpathentry kind="lib" path="/hibernate-3.2/lib/cglib-2.1.3.jar"/>
-	<classpathentry kind="lib" path="lib/testlibs/commons-collections-2.1.1.jar"/>
-	<classpathentry kind="lib" path="lib/testlibs/commons-logging-1.0.4.jar"/>
-	<classpathentry kind="lib" path="lib/testlibs/dom4j-1.6.1.jar"/>
-	<classpathentry kind="lib" path="lib/testlibs/ejb3-persistence.jar"/>
-	<classpathentry kind="lib" path="lib/testlibs/hibernate3.jar"/>
-	<classpathentry kind="lib" path="lib/testlibs/hibernate-annotations.jar"/>
-	<classpathentry kind="lib" path="lib/testlibs/hibernate-commons-annotations.jar"/>
-	<classpathentry kind="lib" path="lib/testlibs/hibernate-entitymanager.jar"/>
-	<classpathentry kind="lib" path="lib/testlibs/javassist.jar"/>
-	<classpathentry kind="lib" path="lib/testlibs/jboss-annotations-ejb3.jar"/>
-	<classpathentry kind="lib" path="lib/testlibs/jboss-archive-browsing.jar"/>
-	<classpathentry kind="lib" path="lib/testlibs/jboss-ejb3x.jar"/>
-	<classpathentry kind="lib" path="etc"/>
-	<classpathentry kind="lib" path="C:/work/documents/presentations/eclipsecon2008/database/lib/hsqldb.jar"/>
-	<classpathentry kind="output" path="build/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src/java"/>
+	<classpathentry kind="src" path="src/test"/>
+	<classpathentry kind="src" path="src/testsupport"/>
+	<classpathentry kind="src" path="src/templates"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="lib" path="lib/freemarker.jar"/>
+	<classpathentry kind="lib" path="lib/jtidy-r8-20060801.jar"/>
+	<classpathentry kind="lib" path="lib/org.eclipse.core.runtime_3.2.0.v20060603.jar"/>
+	<classpathentry kind="lib" path="lib/org.eclipse.equinox.common_3.2.0.v20060603.jar"/>
+	<classpathentry kind="lib" path="lib/org.eclipse.jdt.core_3.2.0.v_671.jar"/>
+	<classpathentry kind="lib" path="lib/org.eclipse.text_3.2.0.v20060605-1400.jar"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
+	<classpathentry kind="lib" path="lib/testlibs/commons-collections-2.1.1.jar"/>
+	<classpathentry kind="lib" path="lib/testlibs/commons-logging-1.0.4.jar"/>
+	<classpathentry kind="lib" path="lib/testlibs/dom4j-1.6.1.jar"/>
+	<classpathentry kind="lib" path="lib/testlibs/ejb3-persistence.jar"/>
+	<classpathentry kind="lib" path="lib/testlibs/hibernate3.jar" sourcepath="/hibernate-3.2"/>
+	<classpathentry kind="lib" path="lib/testlibs/hibernate-annotations.jar"/>
+	<classpathentry kind="lib" path="lib/testlibs/hibernate-commons-annotations.jar"/>
+	<classpathentry kind="lib" path="lib/testlibs/hibernate-entitymanager.jar"/>
+	<classpathentry kind="lib" path="lib/testlibs/javassist.jar"/>
+	<classpathentry kind="lib" path="lib/testlibs/jboss-annotations-ejb3.jar"/>
+	<classpathentry kind="lib" path="lib/testlibs/jboss-archive-browsing.jar"/>
+	<classpathentry kind="lib" path="lib/testlibs/jboss-ejb3x.jar"/>
+	<classpathentry kind="lib" path="etc"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/antlr-2.7.6.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/ant-1.6.5.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/cglib-2.1.3.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/junit-3.8.1.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/jdbc/hsqldb.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/ant-antlr-1.6.5.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/ant-junit-1.6.5.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/ant-launcher-1.6.5.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/ant-swing-1.6.5.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/asm-attrs.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/asm.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/c3p0-0.9.1.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/checkstyle-all.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/cleanimports.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/commons-collections-2.1.1.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/commons-logging-1.0.4.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/concurrent-1.3.2.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/dom4j-1.6.1.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/ehcache-1.2.3.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/jaas.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/jacc-1_0-fr.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/javassist.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/jaxen-1.1-beta-7.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/jboss-cache.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/jboss-common.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/jboss-jmx.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/jboss-system.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/jgroups-2.2.8.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/jta.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/log4j-1.2.11.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/oscache-2.1.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/proxool-0.8.3.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/swarmcache-1.0rc2.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/syndiag2.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/versioncheck.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/xerces-2.6.2.jar"/>
+	<classpathentry kind="lib" path="/hibernate-3.2/lib/xml-apis.jar"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/hibernate-3.2"/>
+	<classpathentry kind="output" path="build/classes"/>
+</classpath>

Modified: branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/DefaultReverseEngineeringStrategy.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/DefaultReverseEngineeringStrategy.java	2009-02-17 10:29:05 UTC (rev 15984)
+++ branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/DefaultReverseEngineeringStrategy.java	2009-02-17 11:06:06 UTC (rev 15985)
@@ -14,6 +14,7 @@
 import org.apache.commons.logging.LogFactory;
 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;
 
@@ -256,8 +257,18 @@
 
 	public boolean isManyToManyTable(Table table) {
 		if(settings.getDetectManyToMany()) {
+			
+			// if the number of columns in the primary key is different 
+			// than the total number of columns then it can't be a middle table
+			PrimaryKey pk = table.getPrimaryKey();
+			if ( pk==null || pk.getColumns().size() != table.getColumnSpan() )
+				return false;
+			
 			Iterator foreignKeyIterator = table.getForeignKeyIterator();
 			List foreignKeys = new ArrayList();
+			
+			// if we have more than 2 fk, means we have more than 2 table implied
+			// in this table --> cannot be a simple many-to-many
 			while ( foreignKeyIterator.hasNext() ) {
 				ForeignKey fkey = (ForeignKey) foreignKeyIterator.next();
 				foreignKeys.add( fkey );
@@ -269,20 +280,28 @@
 				return false;
 			}
 			
+			// tests that all columns are implied in the fks
 			Set columns = new HashSet();
 			Iterator columnIterator = table.getColumnIterator();
 			while ( columnIterator.hasNext() ) {
 				Column column = (Column) columnIterator.next();
 				columns.add(column);
 			}
-		
+			
+						
 			foreignKeyIterator = table.getForeignKeyIterator();
 			while ( !columns.isEmpty() && foreignKeyIterator.hasNext() ) {
 				ForeignKey element = (ForeignKey) foreignKeyIterator.next();				
 				columns.removeAll( element.getColumns() );				
 			}
 			// what if one of the columns is not the primary key?
+			
 			return columns.isEmpty();
+			
+
+			
+			
+			
 		} else {
 			return false;
 		}

Modified: branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/ant/ConfigurationTask.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/ant/ConfigurationTask.java	2009-02-17 10:29:05 UTC (rev 15984)
+++ branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/ant/ConfigurationTask.java	2009-02-17 11:06:06 UTC (rev 15985)
@@ -96,8 +96,11 @@
 		if (configurationFile != null) configuration.configure( configurationFile );
 		addMappings(getFiles() );
 		Properties p = getProperties();
-		if(p!=null) {
-			configuration.setProperties(p);
+		if(p!=null) {		
+			Properties overrides = new Properties();
+			overrides.putAll(configuration.getProperties());
+			overrides.putAll(p);
+			configuration.setProperties(overrides);
 		}		
 	}
 

Modified: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ant/AntHibernateToolTest.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ant/AntHibernateToolTest.java	2009-02-17 10:29:05 UTC (rev 15984)
+++ branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ant/AntHibernateToolTest.java	2009-02-17 11:06:06 UTC (rev 15985)
@@ -51,7 +51,7 @@
 		
 		// allow to test creation of script file + delimiter 
 		// + non execution (test will fail if executed because of crappy delimiter)
-		executeTarget("testScriptCreattion");
+		executeTarget("testScriptCreation");
 		
 		assertTrue(onlyCreate.exists());
 		assertTrue(onlyDrop.exists());

Modified: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/GenericExporterTest.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/GenericExporterTest.java	2009-02-17 10:29:05 UTC (rev 15984)
+++ branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/GenericExporterTest.java	2009-02-17 11:06:06 UTC (rev 15985)
@@ -149,7 +149,7 @@
 			ge.start();
 			fail();
 		} catch(ExporterException e) {
-			assertTrue(e.getMessage().startsWith("Error while processing Entity: HelloWorld"));
+			assertTrue(e.getMessage().startsWith("Error while processing Entity:"));			
 		}
 
 

Modified: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Hbm2HbmXmlTest.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Hbm2HbmXmlTest.java	2009-02-17 10:29:05 UTC (rev 15984)
+++ branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Hbm2HbmXmlTest.java	2009-02-17 11:06:06 UTC (rev 15985)
@@ -307,12 +307,26 @@
 		xpath = DocumentHelper.createXPath("//hibernate-mapping/class/id/generator/param");
 		list = xpath.selectNodes(document);
 		assertEquals("Expected to get correct number of generator param elements", 2, list.size() );
-		Attribute paramTableAtt = ( (Element)list.get(0) ).attribute("name");
+		Element tableElement = (Element)list.get(0);
+		Attribute paramTableAtt = tableElement.attribute("name");
+		Element columnElement = (Element)list.get(1);
+		Attribute paramColumnAtt = columnElement.attribute("name");
+		
+		if(paramTableAtt.getStringValue().equals("column")) {
+			// to make sure the order of the elements doesn't matter.
+			Element tempElement = tableElement;
+			Attribute temp = paramTableAtt;
+			
+			paramTableAtt = paramColumnAtt;
+			tableElement = columnElement;
+			paramColumnAtt = temp;
+			columnElement = tempElement;
+		}
+		
 		assertEquals("Unexpected generator param name", "table", paramTableAtt.getStringValue() );
-		Attribute paramColumnAtt = ( (Element)list.get(1) ).attribute("name");
 		assertEquals("Unexpected generator param name", "column", paramColumnAtt.getStringValue() );
-		assertEquals("Unexpected param value for table", "uni_table", ( (Element)list.get(0) ).getStringValue() );
-		assertEquals("Unexpected param value for column", "next_hi_value", ( (Element)list.get(1) ).getStringValue() );
+		assertEquals("Unexpected param value for table", "uni_table", tableElement.getStringValue() );
+		assertEquals("Unexpected param value for column", "next_hi_value", columnElement.getStringValue() );
     }
 
 	public void testGeneralHbmSettingsQuery()  throws Exception {

Modified: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/ManyToManyTest.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/ManyToManyTest.java	2009-02-17 10:29:05 UTC (rev 15984)
+++ branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/ManyToManyTest.java	2009-02-17 11:06:06 UTC (rev 15985)
@@ -98,7 +98,14 @@
 		assertNotNull( projectClass.getProperty( "employees" ));				
 		
 	}
-	
+
+	public void testFalsePositive() {
+	    
+        assertNotNull("Middle class should be generated.", cfg.getClassMapping( "NonMiddle" ));
+                				
+		
+	}
+
 	public void testBuildMappings() {
 		
 		localCfg.buildMappings();
@@ -115,9 +122,13 @@
 		assertFileAndExists( new File(getOutputDir(), "Project.hbm.xml") );
 		assertFileAndExists( new File(getOutputDir(), "WorksOnContext.hbm.xml") );
 		
+		assertFileAndExists( new File(getOutputDir(), "Right.hbm.xml") );
+		assertFileAndExists( new File(getOutputDir(), "Left.hbm.xml") );
+		assertFileAndExists( new File(getOutputDir(), "NonMiddle.hbm.xml") ); //Must be there since it has a fkey that is not part of the pk
+		
 		assertFalse(new File(getOutputDir(), "WorksOn.hbm.xml").exists() );
 		
-		assertEquals(3, getOutputDir().listFiles().length);
+		assertEquals(6, getOutputDir().listFiles().length);
 		
 		Configuration configuration = new Configuration()
 		    .addFile( new File(getOutputDir(), "Employee.hbm.xml") )
@@ -145,6 +156,10 @@
 			"create table WORKS_ON ( project_id integer not null, employee_id integer not null, primary key (project_id, employee_id), constraint workson_employee foreign key (employee_id) references EMPLOYEE, foreign key (project_id) references PROJECT )",
 			"create table WORKS_ON_CONTEXT ( project_id integer not null, employee_id integer not null, created_by integer, primary key (project_id, employee_id), constraint workson_ctx_employee foreign key (employee_id) references EMPLOYEE, foreign key (project_id) references PROJECT, foreign key (created_by) references EMPLOYEE )",
 			//"alter  table PROJECT add constraint project_manager foreign key (team_lead) references EMPLOYEE"
+			// nonmiddle left and right are used to test a false association table isn't detected.
+			"create table LEFT ( id integer not null, primary key (id) )",
+			"create table RIGHT ( id integer not null, primary key (id) )",
+			"create table NON_MIDDLE ( left_id integer not null, right_id integer not null, primary key (left_id), constraint FK_MIDDLE_LEFT foreign key (left_id) references LEFT, constraint FK_MIDDLE_RIGHT foreign key (right_id) references RIGHT)",
 		};
 	}
 
@@ -154,7 +169,10 @@
 				"drop table WORKS_ON_CONTEXT",
 				"drop table WORKS_ON",
 				"drop table EMPLOYEE",
-				"drop table PROJECT",											
+				"drop table PROJECT",
+				"drop table NON_MIDDLE",
+				"drop table LEFT",
+				"drop table RIGHT",
 			};
 	}
 

Modified: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/OneToOneTest.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/OneToOneTest.java	2009-02-17 10:29:05 UTC (rev 15984)
+++ branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/OneToOneTest.java	2009-02-17 11:06:06 UTC (rev 15985)
@@ -1,316 +1,335 @@
-/*
- * Created on 2004-12-01
- *
- */
-package org.hibernate.tool.test.jdbc2cfg;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.hibernate.MappingException;
-import org.hibernate.cfg.AnnotationConfiguration;
-import org.hibernate.cfg.Configuration;
-import org.hibernate.cfg.JDBCMetaDataConfiguration;
-import org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy;
-import org.hibernate.mapping.OneToOne;
-import org.hibernate.mapping.PersistentClass;
-import org.hibernate.mapping.Property;
-import org.hibernate.mapping.SimpleValue;
-import org.hibernate.tool.JDBCMetaDataBinderTestCase;
-import org.hibernate.tool.hbm2ddl.SchemaValidator;
-import org.hibernate.tool.hbm2x.HibernateMappingExporter;
-import org.hibernate.tool.hbm2x.POJOExporter;
-import org.hibernate.tool.test.TestHelper;
-
-/**
- * @author max
- *
- */
-public class OneToOneTest extends JDBCMetaDataBinderTestCase {
-	
-	public static Test suite() {
-		return new TestSuite(OneToOneTest.class);
-	}
-
-	private JDBCMetaDataConfiguration localCfg;
-
-	protected void configure(JDBCMetaDataConfiguration configuration) {
-    	super.configure( configuration );    	    
-        
-	}
-	
-	protected void setUp() throws Exception {
-		super.setUp();
-		
-		localCfg = new JDBCMetaDataConfiguration();
-        
-        DefaultReverseEngineeringStrategy c = new DefaultReverseEngineeringStrategy();
-                
-        localCfg.setReverseEngineeringStrategy(c);
-        localCfg.readFromJDBC();
-	}
-	protected void tearDown() throws Exception {
-		localCfg = null;
-		
-		super.tearDown();
-	}
-
-	public void testOneToOneSingleColumnBiDirectional() {
-		
-		PersistentClass person = localCfg.getClassMapping("Person");
-		
-		Property addressProperty = person.getProperty("addressPerson");
-		assertNotNull(addressProperty);
-				
-		assertTrue(addressProperty.getValue() instanceof OneToOne);
-		
-		OneToOne oto = (OneToOne) addressProperty.getValue();
-		
-		assertEquals(oto.getColumnSpan(),1);
-		assertEquals("Person", oto.getEntityName());
-		assertEquals("AddressPerson", oto.getReferencedEntityName());
-		
-		
-		assertEquals(2, person.getPropertyClosureSpan());		
-		assertEquals("personId", person.getIdentifierProperty().getName());
-		assertFalse(oto.isConstrained());
-		
-		PersistentClass addressPerson = localCfg.getClassMapping("AddressPerson");
-		
-		
-		Property personProperty = addressPerson.getProperty("person");
-		assertNotNull(personProperty);
-		
-		assertTrue(personProperty.getValue() instanceof OneToOne);
-		
-		oto = (OneToOne) personProperty.getValue();
-		
-		assertTrue(oto.isConstrained());		
-		assertEquals(oto.getColumnSpan(),1);
-		assertEquals("AddressPerson", oto.getEntityName());
-		assertEquals("Person", oto.getReferencedEntityName());
-		
-		assertEquals(2, addressPerson.getPropertyClosureSpan());
-		assertEquals("addressId", addressPerson.getIdentifierProperty().getName());
-				
-	}
-	
-	public void testAddressWithForeignKeyGeneration() {
-		
-		PersistentClass address = localCfg.getClassMapping("AddressPerson");
-		
-		assertEquals("foreign", ((SimpleValue)address.getIdentifier()).getIdentifierGeneratorStrategy());
-	}
-
-	public void testOneToOneMultiColumnBiDirectional() {
-		
-		PersistentClass person = localCfg.getClassMapping("MultiPerson");
-		
-		Property addressProperty = person.getProperty("addressMultiPerson");
-		assertNotNull(addressProperty);
-				
-		assertTrue(addressProperty.getValue() instanceof OneToOne);
-		
-		OneToOne oto = (OneToOne) addressProperty.getValue();
-		
-		assertEquals(oto.getColumnSpan(),2);
-		assertEquals("MultiPerson", oto.getEntityName());
-		assertEquals("AddressMultiPerson", oto.getReferencedEntityName());
-		assertFalse(oto.isConstrained());
-		
-		assertEquals(2, person.getPropertyClosureSpan());		
-		assertEquals("compositeid gives generic id name", "id", person.getIdentifierProperty().getName());
-		
-		PersistentClass addressPerson = localCfg.getClassMapping("AddressMultiPerson");
-		
-		
-		Property personProperty = addressPerson.getProperty("multiPerson");
-		assertNotNull(personProperty);
-		
-		assertTrue(personProperty.getValue() instanceof OneToOne);
-		
-		oto = (OneToOne) personProperty.getValue();
-		
-		assertEquals(oto.getColumnSpan(),2);
-		assertEquals("AddressMultiPerson", oto.getEntityName());
-		assertEquals("MultiPerson", oto.getReferencedEntityName());
-		
-		assertEquals(2, addressPerson.getPropertyClosureSpan());
-		assertEquals("compositeid gives generic id name","id", addressPerson.getIdentifierProperty().getName());
-		assertTrue(oto.isConstrained());
-	}
-	
-
-	public void xtestNoCreation() {
-	    
-        assertNull("No middle class should be generated.", cfg.getClassMapping( "WorksOn" ));
-        
-        assertNotNull("Should create worksontext since one of the foreign keys is not part of pk", cfg.getClassMapping( "WorksOnContext" ));
-        
-        PersistentClass projectClass = cfg.getClassMapping("Project");
-		assertNotNull( projectClass );
-
-		PersistentClass employeeClass = cfg.getClassMapping("Employee");
-		assertNotNull( employeeClass );
-				
-		assertPropertyNotExist( projectClass, "worksOns" );
-		assertPropertyNotExist( employeeClass, "worksOns" );
-		
-        Property property = employeeClass.getProperty( "projects" );
-		assertNotNull( property);
-		assertNotNull( projectClass.getProperty( "employees" ));				
-		
-	}
-	
-	public void testBuildMappings() {
-		
-		localCfg.buildMappings();
-		
-	}
-	
-	public void testGenerateMappingAndReadable() throws MalformedURLException {
-		
-		cfg.buildMappings();
-		
-		HibernateMappingExporter hme = new HibernateMappingExporter(cfg, getOutputDir());
-		hme.start();		
-		
-		assertFileAndExists( new File(getOutputDir(), "Person.hbm.xml") );
-		assertFileAndExists( new File(getOutputDir(), "AddressPerson.hbm.xml") );
-		assertFileAndExists( new File(getOutputDir(), "AddressMultiPerson.hbm.xml") );
-		assertFileAndExists( new File(getOutputDir(), "MultiPerson.hbm.xml") );
-		
-		assertEquals(4, getOutputDir().listFiles().length);
-	
-		POJOExporter exporter = new POJOExporter(cfg, getOutputDir() );
-		exporter.setTemplatePath(new String[0]);
-		exporter.getProperties().setProperty("ejb3", "false");
-		exporter.getProperties().setProperty("jdk5", "false");
-		exporter.start();		
-		
-		ArrayList list = new ArrayList();
-		List jars = new ArrayList();
-		addAnnotationJars(jars);
-		TestHelper.compile(
-				getOutputDir(), getOutputDir(), TestHelper.visitAllFiles( getOutputDir(), list ), "1.5",
-				TestHelper.buildClasspath( jars )
-		);
-        
-		URL[] urls = new URL[] { getOutputDir().toURL() };
-        ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
-		URLClassLoader ucl = new URLClassLoader(urls, oldLoader );
-		try {
-	        Thread.currentThread().setContextClassLoader(ucl);
-			
-		Configuration configuration = new Configuration()
-		    .addFile( new File(getOutputDir(), "Person.hbm.xml") )
-		    .addFile( new File(getOutputDir(), "AddressPerson.hbm.xml") )
-			.addFile( new File(getOutputDir(), "AddressMultiPerson.hbm.xml"))
-			.addFile( new File(getOutputDir(), "MultiPerson.hbm.xml"));
-		
-		configuration.buildMappings();
-
-		new SchemaValidator(configuration).validate();
-		} finally {
-			Thread.currentThread().setContextClassLoader(oldLoader);			
-		}
-	}
-	
-	public void testGenerateAnnotatedClassesAndReadable() throws MappingException, ClassNotFoundException, MalformedURLException {
-		
-		cfg.buildMappings();
-		POJOExporter exporter = new POJOExporter(cfg, getOutputDir() );
-		exporter.setTemplatePath(new String[0]);
-		exporter.getProperties().setProperty("ejb3", "true");
-		exporter.getProperties().setProperty("jdk5", "true");
-		exporter.start();		
-		
-		assertFileAndExists( new File(getOutputDir(), "Person.java") );
-		assertFileAndExists( new File(getOutputDir(), "AddressPerson.java") );
-		assertFileAndExists( new File(getOutputDir(), "MultiPersonId.java") );
-		assertFileAndExists( new File(getOutputDir(), "AddressMultiPerson.java") );
-		assertFileAndExists( new File(getOutputDir(), "AddressMultiPersonId.java") );
-		assertFileAndExists( new File(getOutputDir(), "MultiPerson.java") );
-		
-		assertEquals(6, getOutputDir().listFiles().length);
-		ArrayList list = new ArrayList();
-		List jars = new ArrayList();
-		addAnnotationJars(jars);
-		TestHelper.compile(
-				getOutputDir(), getOutputDir(), TestHelper.visitAllFiles( getOutputDir(), list ), "1.5",
-				TestHelper.buildClasspath( jars )
-		); 
-        URL[] urls = new URL[] { getOutputDir().toURL() };
-        ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
-		URLClassLoader ucl = new URLClassLoader(urls, oldLoader );
-        Class personClass = ucl.loadClass("Person");
-        Class multiPersonClass = ucl.loadClass("MultiPerson");
-        Class addressMultiPerson = ucl.loadClass("AddressMultiPerson");
-        Class addressMultiPersonId = ucl.loadClass("AddressMultiPersonId");
-        Class addressPerson = ucl.loadClass("AddressPerson");
-        Class multiPersonIdClass = ucl.loadClass("MultiPersonId");
-        try {
-        Thread.currentThread().setContextClassLoader(ucl);
-		AnnotationConfiguration configuration = new AnnotationConfiguration();
-		configuration.addAnnotatedClass(personClass)
-			.addAnnotatedClass(multiPersonClass)
-			.addAnnotatedClass(addressMultiPerson)
-			.addAnnotatedClass(addressMultiPersonId)
-			.addAnnotatedClass(addressPerson)
-			.addAnnotatedClass(multiPersonIdClass);
-		
-		configuration.buildMappings();
-		new SchemaValidator(configuration).validate();
-        } finally {
-        	Thread.currentThread().setContextClassLoader(oldLoader);
-        }
-		
-	}
-	
-	private void addAnnotationJars(List jars) {
-		jars.add( "ejb3-persistence.jar" );
-		jars.add( "hibernate-annotations.jar" );
-		jars.add( "hibernate-commons-annotations.jar" );
-		jars.add( "hibernate3.jar" );
-		jars.add( "dom4j-1.6.1.jar" );
-		jars.add( "commons-logging-1.0.4.jar" );
-		
-	}
-	
-	private void assertPropertyNotExist(PersistentClass projectClass, String prop) {
-		try {
-			projectClass.getProperty(prop);
-			fail("property " + prop + " should not exist on " + projectClass);
-		} catch(MappingException e) {
-			// expected
-		}
-	}
-	
-	protected String[] getCreateSQL() {
-		return new String[] {
-			"create table PERSON ( person_id integer not null, name varchar(50), primary key (person_id) )",
-			"create table ADDRESS_PERSON ( address_id integer not null, name varchar(50), primary key (address_id), constraint address_person foreign key (address_id) references PERSON)",			
-			"create table MULTI_PERSON ( person_id integer not null, person_compid integer not null, name varchar(50), primary key (person_id, person_compid) )",
-			"create table ADDRESS_MULTI_PERSON ( address_id integer not null, address_compid integer not null, name varchar(50), primary key (address_id, address_compid), constraint address_multi_person foreign key (address_id, address_compid) references MULTI_PERSON)",
-			
-		};
-	}
-
-	protected String[] getDropSQL() {
-		return new String[] {
-				"drop table ADDRESS_PERSON",
-				"drop table PERSON",
-				"drop table ADDRESS_MULTI_PERSON",
-				"drop table MULTI_PERSON",
-
-			};
-	}
-
-}
+/*
+ * Created on 2004-12-01
+ *
+ */
+package org.hibernate.tool.test.jdbc2cfg;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.hibernate.MappingException;
+import org.hibernate.cfg.AnnotationConfiguration;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.JDBCMetaDataConfiguration;
+import org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy;
+import org.hibernate.mapping.OneToOne;
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.mapping.Property;
+import org.hibernate.mapping.SimpleValue;
+import org.hibernate.tool.JDBCMetaDataBinderTestCase;
+import org.hibernate.tool.hbm2ddl.SchemaValidator;
+import org.hibernate.tool.hbm2x.HibernateMappingExporter;
+import org.hibernate.tool.hbm2x.POJOExporter;
+import org.hibernate.tool.test.TestHelper;
+
+/**
+ * @author max
+ *
+ */
+public class OneToOneTest extends JDBCMetaDataBinderTestCase {
+	
+	public static Test suite() {
+		return new TestSuite(OneToOneTest.class);
+	}
+
+	private JDBCMetaDataConfiguration localCfg;
+
+	protected void configure(JDBCMetaDataConfiguration configuration) {
+    	super.configure( configuration );    	    
+        
+	}
+	
+	protected void setUp() throws Exception {
+		super.setUp();
+		
+		localCfg = new JDBCMetaDataConfiguration();
+        
+        DefaultReverseEngineeringStrategy c = new DefaultReverseEngineeringStrategy();
+                
+        localCfg.setReverseEngineeringStrategy(c);
+        localCfg.readFromJDBC();
+	}
+	protected void tearDown() throws Exception {
+		localCfg = null;
+		
+		super.tearDown();
+	}
+
+	public void testOneToOneSingleColumnBiDirectional() {
+		
+		PersistentClass person = localCfg.getClassMapping("Person");
+		
+		Property addressProperty = person.getProperty("addressPerson");
+		assertNotNull(addressProperty);
+				
+		assertTrue(addressProperty.getValue() instanceof OneToOne);
+		
+		OneToOne oto = (OneToOne) addressProperty.getValue();
+		
+		assertEquals(oto.getColumnSpan(),1);
+		assertEquals("Person", oto.getEntityName());
+		assertEquals("AddressPerson", oto.getReferencedEntityName());
+		
+		
+		assertEquals(2, person.getPropertyClosureSpan());		
+		assertEquals("personId", person.getIdentifierProperty().getName());
+		assertFalse(oto.isConstrained());
+		
+		PersistentClass addressPerson = localCfg.getClassMapping("AddressPerson");
+		
+		
+		Property personProperty = addressPerson.getProperty("person");
+		assertNotNull(personProperty);
+		
+		assertTrue(personProperty.getValue() instanceof OneToOne);
+		
+		oto = (OneToOne) personProperty.getValue();
+		
+		assertTrue(oto.isConstrained());		
+		assertEquals(oto.getColumnSpan(),1);
+		assertEquals("AddressPerson", oto.getEntityName());
+		assertEquals("Person", oto.getReferencedEntityName());
+		
+		assertEquals(2, addressPerson.getPropertyClosureSpan());
+		assertEquals("addressId", addressPerson.getIdentifierProperty().getName());
+				
+	}
+	
+	public void testAddressWithForeignKeyGeneration() {
+		
+		PersistentClass address = localCfg.getClassMapping("AddressPerson");
+		
+		assertEquals("foreign", ((SimpleValue)address.getIdentifier()).getIdentifierGeneratorStrategy());
+	}
+
+	public void testOneToOneMultiColumnBiDirectional() {
+		
+		PersistentClass person = localCfg.getClassMapping("MultiPerson");
+		
+		Property addressProperty = person.getProperty("addressMultiPerson");
+		assertNotNull(addressProperty);
+				
+		assertTrue(addressProperty.getValue() instanceof OneToOne);
+		
+		OneToOne oto = (OneToOne) addressProperty.getValue();
+		
+		assertEquals(oto.getColumnSpan(),2);
+		assertEquals("MultiPerson", oto.getEntityName());
+		assertEquals("AddressMultiPerson", oto.getReferencedEntityName());
+		assertFalse(oto.isConstrained());
+		
+		assertEquals(2, person.getPropertyClosureSpan());		
+		assertEquals("compositeid gives generic id name", "id", person.getIdentifierProperty().getName());
+		
+		PersistentClass addressPerson = localCfg.getClassMapping("AddressMultiPerson");
+		
+		
+		Property personProperty = addressPerson.getProperty("multiPerson");
+		assertNotNull(personProperty);
+		
+		assertTrue(personProperty.getValue() instanceof OneToOne);
+		
+		oto = (OneToOne) personProperty.getValue();
+		
+		assertEquals(oto.getColumnSpan(),2);
+		assertEquals("AddressMultiPerson", oto.getEntityName());
+		assertEquals("MultiPerson", oto.getReferencedEntityName());
+		
+		assertEquals(2, addressPerson.getPropertyClosureSpan());
+		assertEquals("compositeid gives generic id name","id", addressPerson.getIdentifierProperty().getName());
+		assertTrue(oto.isConstrained());
+	}
+	
+
+	public void xtestNoCreation() {
+	    
+        assertNull("No middle class should be generated.", cfg.getClassMapping( "WorksOn" ));
+        
+        assertNotNull("Should create worksontext since one of the foreign keys is not part of pk", cfg.getClassMapping( "WorksOnContext" ));
+        
+        PersistentClass projectClass = cfg.getClassMapping("Project");
+		assertNotNull( projectClass );
+
+		PersistentClass employeeClass = cfg.getClassMapping("Employee");
+		assertNotNull( employeeClass );
+				
+		assertPropertyNotExist( projectClass, "worksOns" );
+		assertPropertyNotExist( employeeClass, "worksOns" );
+		
+        Property property = employeeClass.getProperty( "projects" );
+		assertNotNull( property);
+		assertNotNull( projectClass.getProperty( "employees" ));				
+		
+	}
+	
+	public void testBuildMappings() {
+		
+		localCfg.buildMappings();
+		
+	}
+	
+	public void testGenerateMappingAndReadable() throws MalformedURLException {
+		
+		cfg.buildMappings();
+		
+		HibernateMappingExporter hme = new HibernateMappingExporter(cfg, getOutputDir());
+		hme.start();		
+		
+		assertFileAndExists( new File(getOutputDir(), "Person.hbm.xml") );
+		assertFileAndExists( new File(getOutputDir(), "AddressPerson.hbm.xml") );
+		assertFileAndExists( new File(getOutputDir(), "AddressMultiPerson.hbm.xml") );
+		assertFileAndExists( new File(getOutputDir(), "MultiPerson.hbm.xml") );
+		assertFileAndExists( new File(getOutputDir(), "Middle.hbm.xml") );
+		assertFileAndExists( new File(getOutputDir(), "Left.hbm.xml") );
+		assertFileAndExists( new File(getOutputDir(), "Right.hbm.xml") );
+		
+		assertEquals(7, getOutputDir().listFiles().length);
+	
+		POJOExporter exporter = new POJOExporter(cfg, getOutputDir() );
+		exporter.setTemplatePath(new String[0]);
+		exporter.getProperties().setProperty("ejb3", "false");
+		exporter.getProperties().setProperty("jdk5", "false");
+		exporter.start();		
+		
+		ArrayList list = new ArrayList();
+		List jars = new ArrayList();
+		addAnnotationJars(jars);
+		TestHelper.compile(
+				getOutputDir(), getOutputDir(), TestHelper.visitAllFiles( getOutputDir(), list ), "1.5",
+				TestHelper.buildClasspath( jars )
+		);
+        
+		URL[] urls = new URL[] { getOutputDir().toURL() };
+        ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+		URLClassLoader ucl = new URLClassLoader(urls, oldLoader );
+		try {
+	        Thread.currentThread().setContextClassLoader(ucl);
+			
+		Configuration configuration = new Configuration()
+		    .addFile( new File(getOutputDir(), "Person.hbm.xml") )
+		    .addFile( new File(getOutputDir(), "AddressPerson.hbm.xml") )
+			.addFile( new File(getOutputDir(), "AddressMultiPerson.hbm.xml"))
+			.addFile( new File(getOutputDir(), "MultiPerson.hbm.xml"))
+			.addFile( new File(getOutputDir(), "Middle.hbm.xml"))
+			.addFile( new File(getOutputDir(), "Left.hbm.xml"))
+			.addFile( new File(getOutputDir(), "Right.hbm.xml"));
+		
+		configuration.buildMappings();
+
+		new SchemaValidator(configuration).validate();
+		} finally {
+			Thread.currentThread().setContextClassLoader(oldLoader);			
+		}
+	}
+	
+	public void testGenerateAnnotatedClassesAndReadable() throws MappingException, ClassNotFoundException, MalformedURLException {
+		
+		cfg.buildMappings();
+		POJOExporter exporter = new POJOExporter(cfg, getOutputDir() );
+		exporter.setTemplatePath(new String[0]);
+		exporter.getProperties().setProperty("ejb3", "true");
+		exporter.getProperties().setProperty("jdk5", "true");
+		exporter.start();		
+		
+		assertFileAndExists( new File(getOutputDir(), "Person.java") );
+		assertFileAndExists( new File(getOutputDir(), "AddressPerson.java") );
+		assertFileAndExists( new File(getOutputDir(), "MultiPersonId.java") );
+		assertFileAndExists( new File(getOutputDir(), "AddressMultiPerson.java") );
+		assertFileAndExists( new File(getOutputDir(), "AddressMultiPersonId.java") );
+		assertFileAndExists( new File(getOutputDir(), "MultiPerson.java") );
+		
+		assertEquals(9, getOutputDir().listFiles().length);
+		ArrayList list = new ArrayList();
+		List jars = new ArrayList();
+		addAnnotationJars(jars);
+		TestHelper.compile(
+				getOutputDir(), getOutputDir(), TestHelper.visitAllFiles( getOutputDir(), list ), "1.5",
+				TestHelper.buildClasspath( jars )
+		); 
+        URL[] urls = new URL[] { getOutputDir().toURL() };
+        ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+		URLClassLoader ucl = new URLClassLoader(urls, oldLoader );
+        Class personClass = ucl.loadClass("Person");
+        Class multiPersonClass = ucl.loadClass("MultiPerson");
+        Class addressMultiPerson = ucl.loadClass("AddressMultiPerson");
+        Class addressMultiPersonId = ucl.loadClass("AddressMultiPersonId");
+        Class addressPerson = ucl.loadClass("AddressPerson");
+        Class multiPersonIdClass = ucl.loadClass("MultiPersonId");
+        Class middleClass = ucl.loadClass("Middle");
+        Class rightClass = ucl.loadClass("Left");
+        Class leftClass = ucl.loadClass("Right");
+        try {
+        Thread.currentThread().setContextClassLoader(ucl);
+		AnnotationConfiguration configuration = new AnnotationConfiguration();
+		configuration.addAnnotatedClass(personClass)
+			.addAnnotatedClass(multiPersonClass)
+			.addAnnotatedClass(addressMultiPerson)
+			.addAnnotatedClass(addressMultiPersonId)
+			.addAnnotatedClass(addressPerson)
+			.addAnnotatedClass(multiPersonIdClass)
+			.addAnnotatedClass(middleClass)
+			.addAnnotatedClass(rightClass)
+			.addAnnotatedClass(leftClass);
+		
+		configuration.buildMappings();
+		new SchemaValidator(configuration).validate();
+        } finally {
+        	Thread.currentThread().setContextClassLoader(oldLoader);
+        }
+		
+	}
+	
+	private void addAnnotationJars(List jars) {
+		jars.add( "ejb3-persistence.jar" );
+		jars.add( "hibernate-annotations.jar" );
+		jars.add( "hibernate-commons-annotations.jar" );
+		jars.add( "hibernate3.jar" );
+		jars.add( "dom4j-1.6.1.jar" );
+		jars.add( "commons-logging-1.0.4.jar" );
+		
+	}
+	
+	private void assertPropertyNotExist(PersistentClass projectClass, String prop) {
+		try {
+			projectClass.getProperty(prop);
+			fail("property " + prop + " should not exist on " + projectClass);
+		} catch(MappingException e) {
+			// expected
+		}
+	}
+	
+	protected String[] getCreateSQL() {
+		return new String[] {
+			// middle left and right are used to test a false association table isn't detected.
+			"create table LEFT ( id integer not null, primary key (id) )",
+			"create table RIGHT ( id integer not null, primary key (id) )",
+			"create table MIDDLE ( left_id integer not null, right_id integer not null, primary key (left_id), constraint FK_MIDDLE_LEFT foreign key (left_id) references LEFT, constraint FK_MIDDLE_RIGHT foreign key (right_id) references RIGHT)",
+			"create table PERSON ( person_id integer not null, name varchar(50), primary key (person_id) )",
+			"create table ADDRESS_PERSON ( address_id integer not null, name varchar(50), primary key (address_id), constraint address_person foreign key (address_id) references PERSON)",			
+			"create table MULTI_PERSON ( person_id integer not null, person_compid integer not null, name varchar(50), primary key (person_id, person_compid) )",
+			"create table ADDRESS_MULTI_PERSON ( address_id integer not null, address_compid integer not null, name varchar(50), primary key (address_id, address_compid), constraint address_multi_person foreign key (address_id, address_compid) references MULTI_PERSON)",
+			
+		};
+	}
+
+	protected String[] getDropSQL() {
+		return new String[] {
+				"drop table MIDDLE",
+				"drop table LEFT",
+				"drop table RIGHT",
+				"drop table ADDRESS_PERSON",
+				"drop table PERSON",
+				"drop table ADDRESS_MULTI_PERSON",
+				"drop table MULTI_PERSON",
+
+			};
+	}
+
+}

Modified: branches/Branch_3_2/HibernateExt/tools/src/testsupport/anttest-build.xml
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/testsupport/anttest-build.xml	2009-02-17 10:29:05 UTC (rev 15984)
+++ branches/Branch_3_2/HibernateExt/tools/src/testsupport/anttest-build.xml	2009-02-17 11:06:06 UTC (rev 15985)
@@ -19,15 +19,12 @@
 
 	<target name="cleanup" description="task used for ensuring cleanup to be done even in the case of test failure" depends="afterCfg2hbm"/>
 
-	<target name="testScriptCreattion">
+	<target name="testScriptCreation">
 
-		<mkdir dir="build/testsupport" />
+		
 		<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" />
 		<hibernatetool destdir="${build.dir}/topdown">
-			<classpath>
-				<path location="../../build/testsupport" />
-			</classpath>
-
+		
 			<configuration namingstrategy="org.hibernate.cfg.ImprovedNamingStrategy" entityresolver="DummyEntityResolver">
 				<fileset dir="../test" id="id">
 					<include name="**/*TopDown.hbm.xml" />
@@ -53,13 +50,10 @@
 	
 	<target name="testantcfgUpdateExecuted">
 
-		<mkdir dir="build/testsupport" />
+		
 		<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" />
 		<hibernatetool destdir="${build.dir}/topdown">
-			<classpath>
-				<path location="../../build/testsupport" />
-			</classpath>
-
+		
 			<configuration namingstrategy="org.hibernate.cfg.ImprovedNamingStrategy" entityresolver="DummyEntityResolver">
 				<fileset dir="../test" id="id">
 					<include name="**/*TopDown.hbm.xml" />
@@ -78,13 +72,10 @@
 	
 	<target name="testantcfgExportExecuted">
 
-		<mkdir dir="build/testsupport" />
+		
 		<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" />
 		<hibernatetool destdir="${build.dir}/topdown">
-			<classpath>
-				<path location="../../build/testsupport" />
-			</classpath>
-
+		
 			<configuration namingstrategy="org.hibernate.cfg.ImprovedNamingStrategy" entityresolver="DummyEntityResolver">
 				<fileset dir="../test" id="id">
 					<include name="**/*TopDown.hbm.xml" />
@@ -450,6 +441,7 @@
 		<sql onerror="continue" driver="${hibernate.connection.driver_class}" url="${hibernate.connection.url}" userid="${hibernate.connection.username}" password="${hibernate.connection.password}" classpath="${hibernate-core.home}\jdbc\hsqldb.jar">
 	 delete from VeriSimplyTable where id > 0;
      drop table VeriSimplyTable;
+	 drop table column; 
      </sql>
 
 	</target>
@@ -537,6 +529,7 @@
 		<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath" />
 		<hibernatetool destdir="${build.dir}/querytest">
 			<configuration propertyfile="../../etc/hibernate.properties" configurationfile="querytest-hibernate.cfg.xml" />
+			<classpath location="."/>
 			<query>
 				<hql>from java.lang.Object</hql>
   			    <hql>from java.io.Serializable</hql>

Modified: branches/Branch_3_2/HibernateExt/tools/src/testsupport/querytest-hibernate.cfg.xml
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/testsupport/querytest-hibernate.cfg.xml	2009-02-17 10:29:05 UTC (rev 15984)
+++ branches/Branch_3_2/HibernateExt/tools/src/testsupport/querytest-hibernate.cfg.xml	2009-02-17 11:06:06 UTC (rev 15985)
@@ -3,7 +3,10 @@
 	"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
 
 <hibernate-configuration>
-	<session-factory>
+	<session-factory>	    	    
 		<property name="show_sql">true</property>
+		<!-- Drop and re-create the database schema on startup -->
+        <property name="hibernate.hbm2ddl.auto">create</property>
+		<mapping resource="querytest.hbm.xml"/>
 	</session-factory>
 </hibernate-configuration>
\ No newline at end of file

Added: branches/Branch_3_2/HibernateExt/tools/src/testsupport/querytest.hbm.xml
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/testsupport/querytest.hbm.xml	                        (rev 0)
+++ branches/Branch_3_2/HibernateExt/tools/src/testsupport/querytest.hbm.xml	2009-02-17 11:06:06 UTC (rev 15985)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE hibernate-mapping PUBLIC 
+	"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+	"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.hibernate.tool.hbm2x.hbm2hbmxml">
+<!-- 
+  This mapping demonstrates basic attributes of the mapping document
+
+     (1) Simple id and properties        
+     (2) Id generation with no arguments.
+-->
+    <class name="org.hibernate.mapping.Column">
+        <id name="name">
+        	<generator class="assigned"/>    		
+    	</id>
+    	
+    	<property name="length" 
+    		type="int">
+    		  
+    		</property>
+    			</class>
+
+</hibernate-mapping>




More information about the hibernate-commits mailing list