From: <hib...@li...> - 2006-06-06 17:20:57
|
Author: ste...@jb... Date: 2006-06-06 13:20:50 -0400 (Tue, 06 Jun 2006) New Revision: 9988 Added: trunk/Hibernate3/test/org/hibernate/test/ejb3/ql/ trunk/Hibernate3/test/org/hibernate/test/ejb3/ql/JPAQLCompatibilityTest.java Log: HHH-1817 : test cases Added: trunk/Hibernate3/test/org/hibernate/test/ejb3/ql/JPAQLCompatibilityTest.java =================================================================== --- trunk/Hibernate3/test/org/hibernate/test/ejb3/ql/JPAQLCompatibilityTest.java 2006-06-06 03:50:59 UTC (rev 9987) +++ trunk/Hibernate3/test/org/hibernate/test/ejb3/ql/JPAQLCompatibilityTest.java 2006-06-06 17:20:50 UTC (rev 9988) @@ -0,0 +1,41 @@ +package org.hibernate.test.ejb3.ql; + +import org.hibernate.test.TestCase; +import org.hibernate.cfg.Configuration; +import org.hibernate.cfg.Environment; +import org.hibernate.Session; +import org.hibernate.QueryException; +import org.hibernate.hql.ast.QuerySyntaxException; + +/** + * todo: describe JPAQLCompatibilityTest + * + * @author Steve Ebersole + */ +public class JPAQLCompatibilityTest extends TestCase { + public JPAQLCompatibilityTest(String name) { + super( name ); + } + + protected String[] getMappings() { + return new String[] { "ejb3/Part.hbm.xml", "ejb3/Item.hbm.xml" }; + } + + protected void configure(Configuration cfg) { + super.configure( cfg ); + // todo : account for "compatibility flag" + cfg.setProperty( Environment.JPAQL_STRICT_COMPLIANCE, "true" ); + } + + public void testNoSelectClause() { + Session s = openSession(); + try { + s.createQuery( "from Part" ).list(); + fail( "expecting parse failure" ); + } + catch( QuerySyntaxException qe ) { + // expected behavior + } + s.close(); + } +} |