-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 posts ] 
Author Message
 Post subject: IllegalStateException trying to execute a simple HQL Query
PostPosted: Thu Jul 21, 2005 11:02 am 
Beginner
Beginner

Joined: Fri Feb 20, 2004 6:15 pm
Posts: 38
I'm doing a simple query from Expense table and I get the error below. Other queries work fine, so I'm not sure why Hibernate is having a problem here.


Note that this only happens when I specify a "select description" in front of the from clause. If I just do a "from Expense" it executes fine.

Hibernate version:

3.0.5

Mapping documents:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<!--
Auto-generated mapping file from
the hibernate.org cfg2hbm engine
-->
<class name="edu.uiuc.cs411.rentalproperty.domain.Expense" table="expense">
<id name="expenseId" type="integer">
<column name="expense_id" />
<generator class="native" />
</id>
<many-to-one name="expensecategory" class="edu.uiuc.cs411.rentalproperty.domain.Expensecategory">
<column name="category_id" not-null="true" />
</many-to-one>
<many-to-one name="contact" class="edu.uiuc.cs411.rentalproperty.domain.Contact">
<column name="payee_id" not-null="true" />
</many-to-one>
<many-to-one name="property" class="edu.uiuc.cs411.rentalproperty.domain.Property">
<column name="property_id" not-null="true" />
</many-to-one>
<property name="date" type="date">
<column name="date" length="10" not-null="true" />
</property>
<property name="amount" type="double">
<column name="amount" precision="22" scale="0" not-null="true" />
</property>
<property name="description" type="string">
<column name="description" length="65535" />
</property>
</class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():

Query expensesQuery =
aSession.createQuery("select description from Expense expense ");

List aList = expensesQuery.list();

Full stack trace of any exception that occurs:

java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.IdentNode
\-[ALIAS_REF] IdentNode: 'description' {alias=description, no from element}

org.hibernate.hql.ast.SelectClause.initializeExplicitSelectClause(SelectClause.java:122)
org.hibernate.hql.ast.HqlSqlWalker.useSelectClause(HqlSqlWalker.java:414)
org.hibernate.hql.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:355)
org.hibernate.hql.antlr.HqlSqlBaseWalker.afterQuery(HqlSqlBaseWalker.java:119)
org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:456)
org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:184)
org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:140)
org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189)
org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130)
org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:414)
org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:814)
org.hibernate.impl.SessionImpl.list(SessionImpl.java:773)
org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)

Name and version of the database you are using:

MySQL 4.x

The generated SQL (show_sql=true):

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: 'expense'
\-[SELECT] CommonAST: 'select'
\-[IDENT] CommonAST: 'description'

Debug level Hibernate log excerpt:

http-8080-Processor25 03:39:58 org.hibernate.jdbc.AbstractBatcher getPreparedStatement DEBUG line 343 -preparing statement
http-8080-Processor25 03:39:58 org.hibernate.loader.hql.QueryLoader bindNamedParameters DEBUG line 228 -bindNamedParameters() edu.uiuc.cs411.rentalproperty.domain.Building@1c6480f -> properties0_ [1]
http-8080-Processor25 03:39:58 org.hibernate.type.IntegerType nullSafeSet DEBUG line 59 -binding '1' to parameter: 1
http-8080-Processor25 03:39:58 org.hibernate.loader.hql.QueryLoader bindNamedParameters DEBUG line 228 -bindNamedParameters() edu.uiuc.cs411.rentalproperty.domain.Building@12ee2a -> properties6_ [7]
http-8080-Processor25 03:39:58 org.hibernate.type.IntegerType nullSafeSet DEBUG line 59 -binding '9' to parameter: 7
http-8080-Processor25 03:39:58 org.hibernate.loader.hql.QueryLoader bindNamedParameters DEBUG line 228 -bindNamedParameters() edu.uiuc.cs411.rentalproperty.domain.Building@fae93e -> properties2_ [3]
http-8080-Processor25 03:39:58 org.hibernate.type.IntegerType nullSafeSet DEBUG line 59 -binding '5' to parameter: 3
http-8080-Processor25 03:39:58 org.hibernate.loader.hql.QueryLoader bindNamedParameters DEBUG line 228 -bindNamedParameters() edu.uiuc.cs411.rentalproperty.domain.Building@ba2e48 -> properties1_ [2]
http-8080-Processor25 03:39:58 org.hibernate.type.IntegerType nullSafeSet DEBUG line 59 -binding '4' to parameter: 2
http-8080-Processor25 03:39:58 org.hibernate.loader.hql.QueryLoader bindNamedParameters DEBUG line 228 -bindNamedParameters() edu.uiuc.cs411.rentalproperty.domain.Building@1c83354 -> properties4_ [5]
http-8080-Processor25 03:39:58 org.hibernate.type.IntegerType nullSafeSet DEBUG line 59 -binding '7' to parameter: 5
http-8080-Processor25 03:39:58 org.hibernate.loader.hql.QueryLoader bindNamedParameters DEBUG line 228 -bindNamedParameters() edu.uiuc.cs411.rentalproperty.domain.Building@d210ab -> properties7_ [8]
http-8080-Processor25 03:39:58 org.hibernate.type.IntegerType nullSafeSet DEBUG line 59 -binding '10' to parameter: 8
http-8080-Processor25 03:39:58 org.hibernate.loader.hql.QueryLoader bindNamedParameters DEBUG line 228 -bindNamedParameters() edu.uiuc.cs411.rentalproperty.domain.Building@d0005e -> properties3_ [4]
http-8080-Processor25 03:39:58 org.hibernate.type.IntegerType nullSafeSet DEBUG line 59 -binding '6' to parameter: 4
http-8080-Processor25 03:39:58 org.hibernate.loader.hql.QueryLoader bindNamedParameters DEBUG line 228 -bindNamedParameters() edu.uiuc.cs411.rentalproperty.domain.Building@120a48c -> properties5_ [6]
http-8080-Processor25 03:39:58 org.hibernate.type.IntegerType nullSafeSet DEBUG line 59 -binding '8' to parameter: 6
http-8080-Processor25 03:39:58 org.hibernate.jdbc.AbstractBatcher logOpenResults DEBUG line 274 -about to open ResultSet (open ResultSets: 0, globally: 0)
http-8080-Processor25 03:39:58 org.hibernate.loader.Loader doQuery DEBUG line 377 -processing result set
http-8080-Processor25 03:39:58 org.hibernate.loader.Loader doQuery DEBUG line 399 -done processing result set (0 rows)
http-8080-Processor25 03:39:58 org.hibernate.jdbc.AbstractBatcher logCloseResults DEBUG line 281 -about to close ResultSet (open ResultSets: 1, globally: 1)
http-8080-Processor25 03:39:58 org.hibernate.jdbc.AbstractBatcher logClosePreparedStatement DEBUG line 266 -about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
http-8080-Processor25 03:39:58 org.hibernate.jdbc.AbstractBatcher closePreparedStatement DEBUG line 363 -closing statement
http-8080-Processor25 03:39:58 org.hibernate.loader.Loader initializeEntitiesAndCollections DEBUG line 450 -total objects hydrated: 0
http-8080-Processor25 03:39:58 org.hibernate.engine.PersistenceContext initializeNonLazyCollections DEBUG line 738 -initializing non-lazy collections
http-8080-Processor25 03:39:58 org.hibernate.impl.SessionImpl list DEBUG line 768 -find: select description from Expense expense
http-8080-Processor25 03:39:58 org.hibernate.engine.QueryParameters traceParameters DEBUG line 208 -named parameters: {}
http-8080-Processor25 03:39:58 org.hibernate.hql.ast.QueryTranslatorImpl parse DEBUG line 206 -parse() - HQL: select description from edu.uiuc.cs411.rentalproperty.domain.Expense expense
http-8080-Processor25 03:39:58 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: 'expense'
\-[SELECT] CommonAST: 'select'
\-[IDENT] CommonAST: 'description'

http-8080-Processor25 03:39:58 org.hibernate.hql.antlr.HqlSqlBaseWalker beforeQuery DEBUG line 113 -query() << begin, level = 1
http-8080-Processor25 03:39:58 org.hibernate.hql.ast.FromElement doInitialize DEBUG line 79 -edu.uiuc.cs411.rentalproperty.domain.Expense (expense) -> expense0_
http-8080-Processor25 03:39:58 org.hibernate.hql.ast.FromReferenceNode setResolved DEBUG line 48 -Resolved : description -> description
http-8080-Processor25 03:39:58 org.hibernate.hql.antlr.HqlSqlBaseWalker afterQuery DEBUG line 118 -query() : finishing up...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 21, 2005 11:46 am 
Expert
Expert

Joined: Wed Apr 06, 2005 5:03 pm
Posts: 273
Location: Salt Lake City, Utah, USA
should be:

Code:
select expense.description from Expense expense


(description -> expense.description)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 21, 2005 3:56 pm 
Beginner
Beginner

Joined: Fri Feb 20, 2004 6:15 pm
Posts: 38
nathanmoon wrote:
should be:

Code:
select expense.description from Expense expense


(description -> expense.description)


Nope, I've done it both ways and neither works. The error when you do "expense.description" becomes:

org.hibernate.hql.ast.QuerySyntaxError: unexpected AST node: as col_0_0_ [select expense.description from edu.uiuc.cs411.rentalproperty.domain.Expense expense ]
org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:74)
org.hibernate.hql.ast.QueryTranslatorImpl.generate(QueryTranslatorImpl.java:180)
org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:146)
org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:414)
org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:814)
org.hibernate.impl.SessionImpl.list(SessionImpl.java:773)
org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
edu.uiuc.cs411.rentalproperty.struts.action.ApplicationEntryAction.execute(ApplicationEntryAction.java:114)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)






The parse tree is:

---- SQL AST ---
\-[SELECT] QueryNode: 'SELECT' querySpaces (expense)
+-[SELECT_CLAUSE] SelectClause: '{select clause}'
| +-[DOT] DotNode: 'expense0_.description' {propertyName=description,dereferenceType=4,propertyPath=description,path=expense.description,tableAlias=expense0_,className=edu.uiuc.cs411.rentalproperty.domain.Expense,classAlias=expense}
| | +-[ALIAS_REF] IdentNode: 'expense0_.expense_id' {alias=expense, 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=expense,role=null,tableName=expense,tableAlias=expense0_,colums={,className=edu.uiuc.cs411.rentalproperty.domain.Expense}}


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 21, 2005 8:03 pm 
Senior
Senior

Joined: Wed Jul 13, 2005 4:31 pm
Posts: 142
Location: Seattle, WA
I think you are missing the 'as' keyword.

select expense.description from Expense as expense


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 21, 2005 8:12 pm 
Beginner
Beginner

Joined: Fri Jul 08, 2005 12:38 pm
Posts: 41
Location: Massachusetts, USA
anar: The "as" keyword is optional.

Code:
select expense.description from Expense expense


should work.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 21, 2005 8:20 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
It must be either:

Code:
select expense.description from Expense expense


or:

Code:
select description from Expense


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 22, 2005 6:44 am 
Beginner
Beginner

Joined: Fri Feb 20, 2004 6:15 pm
Posts: 38
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)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 22, 2005 2:26 pm 
Beginner
Beginner

Joined: Fri Feb 20, 2004 6:15 pm
Posts: 38
It seems the problem is that Hibernate is generating incorrect SQL AST from the HQL AST when I use the SELECT statement.

Why is it adding the RIGHT_OUTER join node? That makes no sense to me.

\-[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}}


The actual SQL that is generated is correct, but the QueryTranslator detects that an error occurred and throws it. This is the simplest select HQL you can do, so it's very frustrating that I'm having this problem with Hibernate.

http-8080-Processor25 06:45:38 org.hibernate.hql.ast.QueryTranslatorImpl generate DEBUG line 177 -HQL: select e.description from edu.uiuc.cs411.rentalproperty.domain.Expense e
http-8080-Processor25 06:45:38 org.hibernate.hql.ast.QueryTranslatorImpl generate DEBUG line 178 -SQL: select expense0_.description from expense expense0_


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 22, 2005 2:56 pm 
Expert
Expert

Joined: Wed Apr 06, 2005 5:03 pm
Posts: 273
Location: Salt Lake City, Utah, USA
If you just keep posting your AST tree and expecting someone to figure it out for you, you're going to get bored waiting.

If I were you I'd try some basic problem solving. Make a new mapping file with only the id and description fields in it. Try java.lang.String intead of string. Try a shorter length string. Try renaming the table/columns to rule out reserved words. Get the query working and then slowly add back in the rest of the properties until it breaks.

The problem isn't your HQL syntax. And I'm pretty sure it's not a bug in Hibernate.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 22, 2005 4:13 pm 
Beginner
Beginner

Joined: Fri Feb 20, 2004 6:15 pm
Posts: 38
nathanmoon wrote:
If you just keep posting your AST tree and expecting someone to figure it out for you, you're going to get bored waiting.

If I were you I'd try some basic problem solving. Make a new mapping file with only the id and description fields in it. Try java.lang.String intead of string. Try a shorter length string. Try renaming the table/columns to rule out reserved words. Get the query working and then slowly add back in the rest of the properties until it breaks.

The problem isn't your HQL syntax. And I'm pretty sure it's not a bug in Hibernate.


The query works fine inside of Hibernate console, so I think the mapping is already correct. Why would it work in the console but not work in the code? My other queries work fine.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 22, 2005 4:45 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Looks to me like you have a broken build of Hibernate. I very much doubt that you are really running the official released 3.0.5 binary. Even if you are, you should test against the 3.1 beta release, and verify (via the log) that it is really 3.1 that is being executed.

It is of course virtually impossible that trivial HQL queries are broken in any release of Hibernate.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 22, 2005 6:24 pm 
Beginner
Beginner

Joined: Fri Feb 20, 2004 6:15 pm
Posts: 38
gavin wrote:
Looks to me like you have a broken build of Hibernate. I very much doubt that you are really running the official released 3.0.5 binary. Even if you are, you should test against the 3.1 beta release, and verify (via the log) that it is really 3.1 that is being executed.

It is of course virtually impossible that trivial HQL queries are broken in any release of Hibernate.


Thanks Gavin! I re-downloaded 3.0.5 and overwrote the hibernate3.jar and it started working again. I have no idea why, because I verified that my previous downloaded version was 3.0.5. Maybe I got a bad distribution from a website.

Anyway, I'm working again now. Thanks a lot for mentioning this possibility!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.