Author: steve.ebersole(a)jboss.com
Date: 2006-09-01 19:53:15 -0400 (Fri, 01 Sep 2006)
New Revision: 10434
Added:
trunk/Hibernate3/test/org/hibernate/test/generated/MSSQLGeneratedPropertyEntity.hbm.xml
Modified:
trunk/Hibernate3/test/org/hibernate/test/generated/AbstractGeneratedPropertyTest.java
trunk/Hibernate3/test/org/hibernate/test/generated/TimestampGeneratedValuesWithCachingTest.java
trunk/Hibernate3/test/org/hibernate/test/generated/TriggerGeneratedValuesWithCachingTest.java
trunk/Hibernate3/test/org/hibernate/test/generated/TriggerGeneratedValuesWithoutCachingTest.java
Log:
fixed failures on SQLServer
Modified:
trunk/Hibernate3/test/org/hibernate/test/generated/AbstractGeneratedPropertyTest.java
===================================================================
---
trunk/Hibernate3/test/org/hibernate/test/generated/AbstractGeneratedPropertyTest.java 2006-09-01
21:49:16 UTC (rev 10433)
+++
trunk/Hibernate3/test/org/hibernate/test/generated/AbstractGeneratedPropertyTest.java 2006-09-01
23:53:15 UTC (rev 10434)
@@ -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:
trunk/Hibernate3/test/org/hibernate/test/generated/MSSQLGeneratedPropertyEntity.hbm.xml
===================================================================
---
trunk/Hibernate3/test/org/hibernate/test/generated/MSSQLGeneratedPropertyEntity.hbm.xml 2006-09-01
21:49:16 UTC (rev 10433)
+++
trunk/Hibernate3/test/org/hibernate/test/generated/MSSQLGeneratedPropertyEntity.hbm.xml 2006-09-01
23:53:15 UTC (rev 10434)
@@ -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:
trunk/Hibernate3/test/org/hibernate/test/generated/TimestampGeneratedValuesWithCachingTest.java
===================================================================
---
trunk/Hibernate3/test/org/hibernate/test/generated/TimestampGeneratedValuesWithCachingTest.java 2006-09-01
21:49:16 UTC (rev 10433)
+++
trunk/Hibernate3/test/org/hibernate/test/generated/TimestampGeneratedValuesWithCachingTest.java 2006-09-01
23:53:15 UTC (rev 10434)
@@ -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:
trunk/Hibernate3/test/org/hibernate/test/generated/TriggerGeneratedValuesWithCachingTest.java
===================================================================
---
trunk/Hibernate3/test/org/hibernate/test/generated/TriggerGeneratedValuesWithCachingTest.java 2006-09-01
21:49:16 UTC (rev 10433)
+++
trunk/Hibernate3/test/org/hibernate/test/generated/TriggerGeneratedValuesWithCachingTest.java 2006-09-01
23:53:15 UTC (rev 10434)
@@ -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:
trunk/Hibernate3/test/org/hibernate/test/generated/TriggerGeneratedValuesWithoutCachingTest.java
===================================================================
---
trunk/Hibernate3/test/org/hibernate/test/generated/TriggerGeneratedValuesWithoutCachingTest.java 2006-09-01
21:49:16 UTC (rev 10433)
+++
trunk/Hibernate3/test/org/hibernate/test/generated/TriggerGeneratedValuesWithoutCachingTest.java 2006-09-01
23:53:15 UTC (rev 10434)
@@ -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...
Show replies by date