|
From: <hib...@li...> - 2006-06-02 19:15:10
|
Author: ste...@jb...
Date: 2006-06-02 15:14:50 -0400 (Fri, 02 Jun 2006)
New Revision: 9980
Modified:
trunk/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java
Log:
TCK : query param type mismatch
Modified: trunk/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java 2006-06-02 18:07:08 UTC (rev 9979)
+++ trunk/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java 2006-06-02 19:14:50 UTC (rev 9980)
@@ -22,6 +22,7 @@
import org.hibernate.ScrollableResults;
import org.hibernate.Session;
import org.hibernate.Transaction;
+import org.hibernate.TypeMismatchException;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.DB2Dialect;
@@ -84,6 +85,24 @@
cfg.setProperty( Environment.GENERATE_STATISTICS, "true" );
}
+ public void testParameterTypeMismatchFails() {
+ Session s = openSession();
+ s.beginTransaction();
+
+ Query query = s.createQuery( "from Animal a where a.description = :nonstring" )
+ .setParameter( "nonstring", new Integer(1) );
+ try {
+ query.list();
+ fail( "query execution should have failed" );
+ }
+ catch( TypeMismatchException tme ) {
+ // expected behavior
+ }
+
+ s.getTransaction().commit();
+ s.close();
+ }
+
public void testMultipleBagFetchesFail() {
Session s = openSession();
s.beginTransaction();
|