Author: steve.ebersole(a)jboss.com
Date: 2006-11-16 15:22:07 -0500 (Thu, 16 Nov 2006)
New Revision: 10830
Modified:
trunk/Hibernate3/src/org/hibernate/hql/classic/PathExpressionParser.java
trunk/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java
trunk/Hibernate3/test/org/hibernate/test/hql/HQLTest.java
Log:
classic translator fix due to change in EntityType
Modified: trunk/Hibernate3/src/org/hibernate/hql/classic/PathExpressionParser.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/hql/classic/PathExpressionParser.java 2006-11-16
20:21:47 UTC (rev 10829)
+++ trunk/Hibernate3/src/org/hibernate/hql/classic/PathExpressionParser.java 2006-11-16
20:22:07 UTC (rev 10830)
@@ -187,9 +187,11 @@
catch ( MappingException me ) {
throw new QueryException( me );
}
- boolean isNamedIdPropertyShortcut = idPropertyName != null &&
- idPropertyName.equals( propertyName );
+ boolean isNamedIdPropertyShortcut = idPropertyName != null
+ && idPropertyName.equals( propertyName )
+ && propertyType.isReferenceToPrimaryKey();
+
if ( isIdShortcut || isNamedIdPropertyShortcut ) {
// special shortcut for id properties, skip the join!
// this must only occur at the _end_ of a path expression
Modified: trunk/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java 2006-11-16
20:21:47 UTC (rev 10829)
+++ trunk/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java 2006-11-16
20:22:07 UTC (rev 10830)
@@ -99,6 +99,9 @@
// caused the classic parser to suddenly start throwing exceptions on
// this query, apparently relying on the buggy behavior somehow; thus
// moved here to at least get some syntax checking...
+ //
+ // fyi... found and fixed the problem in the classic parser; still
+ // leaving here for syntax checking
new SyntaxChecker( "from Commento c where c.marelo.commento.mcompr is null"
).checkAll();
}
Modified: trunk/Hibernate3/test/org/hibernate/test/hql/HQLTest.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/hql/HQLTest.java 2006-11-16 20:21:47 UTC (rev
10829)
+++ trunk/Hibernate3/test/org/hibernate/test/hql/HQLTest.java 2006-11-16 20:22:07 UTC (rev
10830)
@@ -1016,6 +1016,11 @@
assertTranslation( "from Baz baz inner join baz.components comp where
comp.name='foo'" );
}
+ public void testNestedComponentIsNull() {
+ // From MapTest...
+ assertTranslation( "from Commento c where c.marelo.commento.mcompr is null"
);
+ }
+
public void testOneToOneJoinedFetch() throws Exception {
// From OneToOneTest.testOneToOneOnSubclass
assertTranslation( "from org.hibernate.test.onetoone.joined.Person p join fetch
p.address left join fetch p.mailingAddress" );