[hibernate-commits] Hibernate SVN: r17458 - core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hql.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Tue Sep 1 22:00:23 EDT 2009


Author: stliu
Date: 2009-09-01 22:00:23 -0400 (Tue, 01 Sep 2009)
New Revision: 17458

Modified:
   core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hql/ASTParserLoadingTest.java
Log:
JBPAPP-2715 HHH-4114 : Core - ASTParserLoadingTest fails due to missing "bit_length" function

Modified: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hql/ASTParserLoadingTest.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hql/ASTParserLoadingTest.java	2009-09-01 14:42:20 UTC (rev 17457)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hql/ASTParserLoadingTest.java	2009-09-02 02:00:23 UTC (rev 17458)
@@ -1866,11 +1866,21 @@
 
 		hql = "from Animal a where mod(16, 4) = 4";
 		session.createQuery(hql).list();
-
-		hql = "from Animal a where bit_length(a.bodyWeight) = 24";
+		/**
+		 * PostgreSQL >= 8.3.7 typecasts are no longer automatically allowed 
+		 * <link>http://www.postgresql.org/docs/current/static/release-8-3.html</link>
+		*/ 
+		if(getDialect() instanceof PostgreSQLDialect){
+			hql = "from Animal a where bit_length(str(a.bodyWeight)) = 24";
+		} else{
+			hql = "from Animal a where bit_length(a.bodyWeight) = 24";
+		}
 		session.createQuery(hql).list();
-
-		hql = "select bit_length(a.bodyWeight) from Animal a";
+		if(getDialect() instanceof PostgreSQLDialect){
+			hql = "select bit_length(str(a.bodyWeight)) from Animal a";
+		} else{
+			hql = "select bit_length(a.bodyWeight) from Animal a";
+		}
 		session.createQuery(hql).list();
 
 		/*hql = "select object(a) from Animal a where CURRENT_DATE = :p1 or CURRENT_TIME = :p2 or CURRENT_TIMESTAMP = :p3";



More information about the hibernate-commits mailing list