[hibernate-commits] Hibernate SVN: r10959 - branches/Branch_3_2/Hibernate3/test/org/hibernate/test/hql

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Fri Dec 8 07:34:21 EST 2006


Author: steve.ebersole at jboss.com
Date: 2006-12-08 07:34:18 -0500 (Fri, 08 Dec 2006)
New Revision: 10959

Modified:
   branches/Branch_3_2/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java
   branches/Branch_3_2/Hibernate3/test/org/hibernate/test/hql/HQLTest.java
Log:
fixed org.hibernate.test.hql.HQLTest#testConcatenation on sql server

Modified: branches/Branch_3_2/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java
===================================================================
--- branches/Branch_3_2/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java	2006-12-08 08:18:06 UTC (rev 10958)
+++ branches/Branch_3_2/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java	2006-12-08 12:34:18 UTC (rev 10959)
@@ -96,6 +96,15 @@
 		cfg.setProperty( Environment.GENERATE_STATISTICS, "true" );
 	}
 
+	public void testConcatenation() {
+		// simple syntax checking...
+		Session s = openSession();
+		s.beginTransaction();
+		s.createQuery( "from Human h where h.nickName = '1' || 'ov' || 'tha' || 'few'" ).list();
+		s.getTransaction().commit();
+		s.close();
+	}
+
 	public void testCrazyIdFieldNames() {
 		MoreCrazyIdFieldNameStuffEntity top = new MoreCrazyIdFieldNameStuffEntity( "top" );
 		HeresAnotherCrazyIdFieldName next = new HeresAnotherCrazyIdFieldName( "next" );

Modified: branches/Branch_3_2/Hibernate3/test/org/hibernate/test/hql/HQLTest.java
===================================================================
--- branches/Branch_3_2/Hibernate3/test/org/hibernate/test/hql/HQLTest.java	2006-12-08 08:18:06 UTC (rev 10958)
+++ branches/Branch_3_2/Hibernate3/test/org/hibernate/test/hql/HQLTest.java	2006-12-08 12:34:18 UTC (rev 10959)
@@ -19,6 +19,7 @@
 import org.hibernate.dialect.MySQLDialect;
 import org.hibernate.dialect.Oracle9Dialect;
 import org.hibernate.dialect.PostgreSQLDialect;
+import org.hibernate.dialect.SybaseDialect;
 import org.hibernate.dialect.function.SQLFunction;
 import org.hibernate.engine.SessionFactoryImplementor;
 import org.hibernate.engine.query.HQLQueryPlan;
@@ -567,7 +568,13 @@
 	}
 
 	public void testConcatenation() {
-		if ( getDialect() instanceof MySQLDialect ) return; //MySQL uses concat(x, y, z)
+		if ( getDialect() instanceof MySQLDialect || getDialect() instanceof SybaseDialect ) {
+			// MySQL uses concat(x, y, z)
+			// SQL Server replaces '||' with '+'
+			//
+			// this is syntax checked in {@link ASTParserLoadingTest#testConcatenation}
+			return;
+		}
 		assertTranslation("from Human h where h.nickName = '1' || 'ov' || 'tha' || 'few'");
 	}
 




More information about the hibernate-commits mailing list