[hibernate-commits] Hibernate SVN: r14808 - in core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate: test/legacy and 1 other directory.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Wed Jun 25 01:06:55 EDT 2008


Author: gbadner
Date: 2008-06-25 01:06:52 -0400 (Wed, 25 Jun 2008)
New Revision: 14808

Modified:
   core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/junit/functional/FunctionalTestCase.java
   core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/legacy/MasterDetailTest.java
Log:
JBPAPP-231 - MasterDetailTest fails against MSSQL 2005


Modified: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/junit/functional/FunctionalTestCase.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/junit/functional/FunctionalTestCase.java	2008-06-25 01:57:10 UTC (rev 14807)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/junit/functional/FunctionalTestCase.java	2008-06-25 05:06:52 UTC (rev 14808)
@@ -4,6 +4,7 @@
 import java.util.Map;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.sql.Connection;
 
 import org.hibernate.cfg.Configuration;
 import org.hibernate.cfg.Mappings;
@@ -278,8 +279,30 @@
 	}
 
 
+	/**
+	 * Do connections enforce SERIALIZABLE isolation...
+	 * 
+	 * @return
+	 * @throws Exception
+	 */
+	protected boolean isSerializableIsolationEnforced() throws Exception {
+		Connection conn = null;
+		try {
+			conn = sfi().getConnectionProvider().getConnection();
+			return conn.getTransactionIsolation() >= Connection.TRANSACTION_SERIALIZABLE;
+		}
+		finally {
+			if ( conn != null ) {
+				try {
+					sfi().getConnectionProvider().closeConnection( conn );
+				}
+				catch ( Throwable ignore ) {
+					// ignore...
+				}
+			}
+		}
+	}
 
-
 	/**
 	 * Is connection at least read committed?
 	 * <p/>

Modified: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/legacy/MasterDetailTest.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/legacy/MasterDetailTest.java	2008-06-25 01:57:10 UTC (rev 14807)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/legacy/MasterDetailTest.java	2008-06-25 05:06:52 UTC (rev 14808)
@@ -3,6 +3,7 @@
 
 import java.io.Serializable;
 import java.sql.Connection;
+import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
@@ -835,6 +836,10 @@
 	}
 
 	public void testCachedCollectionRefresh() throws Exception {
+		if ( isSerializableIsolationEnforced() ) {
+			reportSkip( "SERIALIZABLE isolation", "cached collection refreshing" );
+			return;
+		}
 		Session s = openSession();
 		Category c = new Category();
 		List list = new ArrayList();
@@ -853,7 +858,9 @@
 		s.close();
 		
 		s = openSession();
-		if ( (getDialect() instanceof MySQLDialect) ) s.connection().setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
+		if ( (getDialect() instanceof MySQLDialect) ) {
+			s.connection().setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
+		}
 		c = (Category) s.load(Category.class, id);
 		c.getSubcategories().size(); //force load
 




More information about the hibernate-commits mailing list