[hibernate-commits] Hibernate SVN: r10435 - branches/Branch_3_2/Hibernate3/test/org/hibernate/test/generated

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Fri Sep 1 19:53:41 EDT 2006


Author: steve.ebersole at jboss.com
Date: 2006-09-01 19:53:40 -0400 (Fri, 01 Sep 2006)
New Revision: 10435

Added:
   branches/Branch_3_2/Hibernate3/test/org/hibernate/test/generated/MSSQLGeneratedPropertyEntity.hbm.xml
Modified:
   branches/Branch_3_2/Hibernate3/test/org/hibernate/test/generated/AbstractGeneratedPropertyTest.java
   branches/Branch_3_2/Hibernate3/test/org/hibernate/test/generated/TimestampGeneratedValuesWithCachingTest.java
   branches/Branch_3_2/Hibernate3/test/org/hibernate/test/generated/TriggerGeneratedValuesWithCachingTest.java
   branches/Branch_3_2/Hibernate3/test/org/hibernate/test/generated/TriggerGeneratedValuesWithoutCachingTest.java
Log:
fixed failures on SQLServer

Modified: branches/Branch_3_2/Hibernate3/test/org/hibernate/test/generated/AbstractGeneratedPropertyTest.java
===================================================================
--- branches/Branch_3_2/Hibernate3/test/org/hibernate/test/generated/AbstractGeneratedPropertyTest.java	2006-09-01 23:53:15 UTC (rev 10434)
+++ branches/Branch_3_2/Hibernate3/test/org/hibernate/test/generated/AbstractGeneratedPropertyTest.java	2006-09-01 23:53:40 UTC (rev 10435)
@@ -16,10 +16,6 @@
 		super( x );
 	}
 
-	protected final String[] getMappings() {
-		return new String[] { "generated/GeneratedPropertyEntity.hbm.xml" };
-	}
-
 	public final void testGeneratedProperty() {
 		GeneratedPropertyEntity entity = new GeneratedPropertyEntity();
 		entity.setName( "entity-1" );
@@ -41,5 +37,11 @@
 		s.close();
 
 		assertTrue( Hibernate.BINARY.isEqual( bytes, entity.getLastModified() ) );
+
+		s = openSession();
+		t = s.beginTransaction();
+		s.delete( entity );
+		t.commit();
+		s.close();
 	}
 }

Added: branches/Branch_3_2/Hibernate3/test/org/hibernate/test/generated/MSSQLGeneratedPropertyEntity.hbm.xml
===================================================================
--- branches/Branch_3_2/Hibernate3/test/org/hibernate/test/generated/MSSQLGeneratedPropertyEntity.hbm.xml	2006-09-01 23:53:15 UTC (rev 10434)
+++ branches/Branch_3_2/Hibernate3/test/org/hibernate/test/generated/MSSQLGeneratedPropertyEntity.hbm.xml	2006-09-01 23:53:40 UTC (rev 10435)
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!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.test.generated">
+
+    <class name="GeneratedPropertyEntity" table="gen_prop">
+
+    	<id name="id">
+    		<generator class="native"/>
+    	</id>
+        <property name="name"/>
+        <property name="lastModified" generated="always" type="binary">
+            <column name="lastModified" length="8" sql-type="TIMESTAMP"/>
+        </property>
+
+	</class>
+
+</hibernate-mapping>
\ No newline at end of file

Modified: branches/Branch_3_2/Hibernate3/test/org/hibernate/test/generated/TimestampGeneratedValuesWithCachingTest.java
===================================================================
--- branches/Branch_3_2/Hibernate3/test/org/hibernate/test/generated/TimestampGeneratedValuesWithCachingTest.java	2006-09-01 23:53:15 UTC (rev 10434)
+++ branches/Branch_3_2/Hibernate3/test/org/hibernate/test/generated/TimestampGeneratedValuesWithCachingTest.java	2006-09-01 23:53:40 UTC (rev 10435)
@@ -1,11 +1,6 @@
 // $Id$
 package org.hibernate.test.generated;
 
-import java.sql.SQLWarning;
-import java.sql.Statement;
-
-import org.hibernate.HibernateException;
-import org.hibernate.Session;
 import org.hibernate.dialect.SybaseDialect;
 import org.hibernate.dialect.Dialect;
 
@@ -23,33 +18,16 @@
 		super( x );
 	}
 
+	protected final String[] getMappings() {
+		return new String[] { "generated/MSSQLGeneratedPropertyEntity.hbm.xml" };
+	}
+
 	public boolean appliesTo(Dialect dialect) {
 		// this test is specific to Sybase/SQLServer as it is testing support
 		// for their TIMESTAMP datatype...
 		return ( dialect instanceof SybaseDialect );
 	}
 
-	protected void afterSessionFactoryBuilt() throws Exception {
-		// alter the table column to be of type TIMESTAMP, instead of the normal
-		// BINARY/VARBINARY type-mapping.
-		Session s = openSession();
-		Statement stmnt = s.connection().createStatement();
-		stmnt.execute( "alter table gen_prop drop column lastModified" );
-		SQLWarning warning = stmnt.getWarnings();
-		if ( warning != null ) {
-			stmnt.clearWarnings();
-			throw new HibernateException( "could not drop lastModified column : " + warning );
-		}
-		stmnt.execute( "alter table gen_prop add lastModified TIMESTAMP NOT NULL" );
-		warning = stmnt.getWarnings();
-		if ( warning != null ) {
-			stmnt.clearWarnings();
-			throw new HibernateException( "could not re-create lastModified column as TIMESTAMP type : " + warning );
-		}
-		stmnt.close();
-		s.close();
-	}
-
 	public static Test suite() {
 		return new TestSuite( TimestampGeneratedValuesWithCachingTest.class );
 	}

Modified: branches/Branch_3_2/Hibernate3/test/org/hibernate/test/generated/TriggerGeneratedValuesWithCachingTest.java
===================================================================
--- branches/Branch_3_2/Hibernate3/test/org/hibernate/test/generated/TriggerGeneratedValuesWithCachingTest.java	2006-09-01 23:53:15 UTC (rev 10434)
+++ branches/Branch_3_2/Hibernate3/test/org/hibernate/test/generated/TriggerGeneratedValuesWithCachingTest.java	2006-09-01 23:53:40 UTC (rev 10435)
@@ -18,6 +18,10 @@
 		super( x );
 	}
 
+	protected final String[] getMappings() {
+		return new String[] { "generated/GeneratedPropertyEntity.hbm.xml" };
+	}
+
 	public boolean appliesTo(Dialect dialect) {
 		// currently have only defined triggers for oracle...
 		// TODO : add more triggers for dialects which allow mods in triggers...

Modified: branches/Branch_3_2/Hibernate3/test/org/hibernate/test/generated/TriggerGeneratedValuesWithoutCachingTest.java
===================================================================
--- branches/Branch_3_2/Hibernate3/test/org/hibernate/test/generated/TriggerGeneratedValuesWithoutCachingTest.java	2006-09-01 23:53:15 UTC (rev 10434)
+++ branches/Branch_3_2/Hibernate3/test/org/hibernate/test/generated/TriggerGeneratedValuesWithoutCachingTest.java	2006-09-01 23:53:40 UTC (rev 10435)
@@ -18,6 +18,10 @@
 		super( x );
 	}
 
+	protected final String[] getMappings() {
+		return new String[] { "generated/GeneratedPropertyEntity.hbm.xml" };
+	}
+
 	public boolean appliesTo(Dialect dialect) {
 		// currently have only defined triggers for oracle...
 		// TODO : add more triggers for dialects which allow mods in triggers...




More information about the hibernate-commits mailing list