gavin wrote:
It must be either:
Code:
select expense.description from Expense expense
or:
Code:
select description from Expense
I've done both and they both give the same unexpected AST node error. Is this a bug then?
http-8080-Processor25 10:39:57 org.hibernate.engine.PersistenceContext initializeNonLazyCollections DEBUG line 738 -initializing non-lazy collections
http-8080-Processor25 10:39:57 org.hibernate.impl.SessionImpl list DEBUG line 768 -find: select e.description from Expense e
http-8080-Processor25 10:39:57 org.hibernate.engine.QueryParameters traceParameters DEBUG line 208 -named parameters: {}
http-8080-Processor25 10:39:57 org.hibernate.hql.ast.QueryTranslatorImpl parse DEBUG line 206 -parse() - HQL: select e.description from edu.uiuc.cs411.rentalproperty.domain.Expense e
http-8080-Processor25 10:39:57 org.hibernate.hql.AST logAst DEBUG line 226 ---- HQL AST ---
\-[QUERY] CommonAST: 'query'
\-[SELECT_FROM] CommonAST: 'SELECT_FROM'
+-[FROM] CommonAST: 'from'
| +-[DOT] CommonAST: '.'
| | +-[DOT] CommonAST: '.'
| | | +-[DOT] CommonAST: '.'
| | | | +-[DOT] CommonAST: '.'
| | | | | +-[DOT] CommonAST: '.'
| | | | | | +-[IDENT] CommonAST: 'edu'
| | | | | | \-[IDENT] CommonAST: 'uiuc'
| | | | | \-[IDENT] CommonAST: 'cs411'
| | | | \-[IDENT] CommonAST: 'rentalproperty'
| | | \-[IDENT] CommonAST: 'domain'
| | \-[IDENT] CommonAST: 'Expense'
| \-[ALIAS] CommonAST: 'e'
\-[SELECT] CommonAST: 'select'
\-[DOT] CommonAST: '.'
+-[IDENT] CommonAST: 'e'
\-[IDENT] CommonAST: 'description'
http-8080-Processor25 10:39:57 org.hibernate.hql.antlr.HqlSqlBaseWalker beforeQuery DEBUG line 113 -query() << begin, level = 1
http-8080-Processor25 10:39:57 org.hibernate.hql.ast.FromElement doInitialize DEBUG line 79 -edu.uiuc.cs411.rentalproperty.domain.Expense (e) -> expense0_
http-8080-Processor25 10:39:57 org.hibernate.hql.ast.FromReferenceNode setResolved DEBUG line 48 -Resolved : e -> expense0_.expense_id
http-8080-Processor25 10:39:57 org.hibernate.hql.ast.DotNode getDataType DEBUG line 441 -getDataType() : description -> org.hibernate.type.StringType@1b66aff
http-8080-Processor25 10:39:57 org.hibernate.hql.ast.FromReferenceNode setResolved DEBUG line 48 -Resolved : e.description -> expense0_.description
http-8080-Processor25 10:39:57 org.hibernate.hql.antlr.HqlSqlBaseWalker afterQuery DEBUG line 118 -query() : finishing up...
http-8080-Processor25 10:39:57 org.hibernate.hql.ast.JoinProcessor addJoinNodes DEBUG line 111 -Using FROM fragment [expense expense0_]
http-8080-Processor25 10:39:57 org.hibernate.hql.antlr.HqlSqlBaseWalker afterQuery DEBUG line 121 -query() >> end, level = 1
http-8080-Processor25 10:39:57 org.hibernate.hql.AST logAst DEBUG line 226 ---- SQL AST ---
\-[SELECT] QueryNode: 'SELECT' querySpaces (expense)
+-[SELECT_CLAUSE] SelectClause: '{select clause}'
| +-[DOT] DotNode: 'expense0_.description' {propertyName=description,dereferenceType=4,propertyPath=description,path=e.description,tableAlias=expense0_,className=edu.uiuc.cs411.rentalproperty.domain.Expense,classAlias=e}
| | +-[ALIAS_REF] IdentNode: 'expense0_.expense_id' {alias=e, className=edu.uiuc.cs411.rentalproperty.domain.Expense, tableAlias=expense0_}
| | \-[IDENT] IdentNode: 'description' {originalText=description}
| \-[RIGHT_OUTER] SqlNode: ' as col_0_0_'
\-[FROM] FromClause: 'from' FromClause{from}
\-[FROM_FRAGMENT] FromElement: 'expense expense0_' FromElement{explicit,not a collection join,classAlias=e,role=null,tableName=expense,tableAlias=expense0_,colums={,className=edu.uiuc.cs411.rentalproperty.domain.Expense}}
http-8080-Processor25 10:39:57 hql.parser reportError ERROR line 40 -*** ERROR: <AST>:0:0: unexpected AST node: as col_0_0_
http-8080-Processor25 10:39:57 org.hibernate.hql.ast.QueryTranslatorImpl generate DEBUG line 177 -HQL: select e.description from edu.uiuc.cs411.rentalproperty.domain.Expense e
http-8080-Processor25 10:39:57 org.hibernate.hql.ast.QueryTranslatorImpl generate DEBUG line 178 -SQL: select expense0_.description from expense expense0_
http-8080-Processor25 10:39:57 org.apache.struts.action.RequestProcessor processException WARN line 516 -Unhandled Exception thrown: class org.hibernate.hql.ast.QuerySyntaxError
http-8080-Processor25 10:39:57 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/cs411web].[action] invoke ERROR line 253 -Servlet.service() for servlet action threw exception
org.hibernate.hql.ast.QuerySyntaxError: unexpected AST node: as col_0_0_ [select e.description from edu.uiuc.cs411.rentalproperty.domain.Expense e]
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:74)
at org.hibernate.hql.ast.QueryTranslatorImpl.generate(QueryTranslatorImpl.java:180)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:146)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:414)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:814)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:773)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at edu.uiuc.cs411.rentalproperty.struts.action.ApplicationEntryAction.execute(ApplicationEntryAction.java:114)