[hibernate-commits] Hibernate SVN: r11257 - in trunk/Hibernate3: test/org/hibernate/test/hql and 1 other directory.
hibernate-commits at lists.jboss.org
hibernate-commits at lists.jboss.org
Wed Mar 7 17:39:25 EST 2007
Author: steve.ebersole at jboss.com
Date: 2007-03-07 17:39:25 -0500 (Wed, 07 Mar 2007)
New Revision: 11257
Modified:
trunk/Hibernate3/src/org/hibernate/hql/ast/util/LiteralProcessor.java
trunk/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java
Log:
HHH-2376 : error referencing the FQN of the class for special HQL .class property resolution
Modified: trunk/Hibernate3/src/org/hibernate/hql/ast/util/LiteralProcessor.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/hql/ast/util/LiteralProcessor.java 2007-03-07 19:32:58 UTC (rev 11256)
+++ trunk/Hibernate3/src/org/hibernate/hql/ast/util/LiteralProcessor.java 2007-03-07 22:39:25 UTC (rev 11257)
@@ -93,11 +93,12 @@
}
public void lookupConstant(DotNode node) throws SemanticException {
- String text = getText( node );
+ String text = ASTUtil.getPathText( node );
Queryable persister = walker.getSessionFactoryHelper().findQueryableUsingImports( text );
if ( persister != null ) {
// the name of an entity class
final String discrim = persister.getDiscriminatorSQLValue();
+ node.setDataType( persister.getDiscriminatorType() );
if ( InFragment.NULL.equals(discrim) || InFragment.NOT_NULL.equals(discrim) ) {
throw new InvalidPathException( "subclass test not allowed for null or not null discriminator: '" + text + "'" );
}
@@ -180,10 +181,6 @@
node.setResolvedConstant( text );
}
- private String getText(AST node) {
- return ASTUtil.getPathText( node );
- }
-
public void processBoolean(AST constant) {
// TODO: something much better - look at the type of the other expression!
// TODO: Have comparisonExpression and/or arithmeticExpression rules complete the resolution of boolean nodes.
Modified: trunk/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java 2007-03-07 19:32:58 UTC (rev 11256)
+++ trunk/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java 2007-03-07 22:39:25 UTC (rev 11257)
@@ -279,6 +279,14 @@
new SyntaxChecker( "from Animal an where an.class = Dog" ).checkAll();
}
+ public void testSpecialClassPropertyReferenceFQN() {
+ // tests relating to HHH-2376
+ new SyntaxChecker( "from Zoo zoo where zoo.class = org.hibernate.test.hql.PettingZoo" ).checkAll();
+ new SyntaxChecker( "select a.description from Animal a where a.class = org.hibernate.test.hql.Mammal" ).checkAll();
+ new SyntaxChecker( "from DomesticAnimal an where an.class = org.hibernate.test.hql.Dog" ).checkAll();
+ new SyntaxChecker( "from Animal an where an.class = org.hibernate.test.hql.Dog" ).checkAll();
+ }
+
public void testSubclassOrSuperclassPropertyReferenceInJoinedSubclass() {
// this is a long standing bug in Hibernate; see HHH-1631 for details and history
//
More information about the hibernate-commits
mailing list