-->
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.  [ 3 posts ] 
Author Message
 Post subject: Cast- No data type for node:org.hibernate.hql.ast.MethodNode
PostPosted: Thu Dec 15, 2005 8:22 pm 
Beginner
Beginner

Joined: Thu Feb 03, 2005 10:42 pm
Posts: 30
I am doing a sql where I am trying to perform a cast of a boolean to an integer and I am getting a weird error. Thanks for any help.

Here is my hql:(this is a simplified version i am testing with doesn't accomplish anything)
Quote:
select treatmentCourse.id, cast(todos.done as integer) from TreatmentCourse treatmentCourse left outer join treatmentCourse.todos as todos group by treatmentCourse.id


todos.done is a boolean value and I want to cast it to an integer. The reason is so I can do a sum(cast(todos.don as integer)). I am using hsqldb and I have tried this sql out directly on the db and it works fine. But not through hibernate.

Here is the error I am getting:

java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.MethodNode
\-[METHOD_CALL] MethodNode: '('
+-[METHOD_NAME] IdentNode: 'cast' {originalText=cast}
\-[EXPR_LIST] SqlNode: 'exprList'
+-[DOT] DotNode: 'todos1_.DONE' {propertyName=done,dereferenceType=4,propertyPath=done,path=todos.done,tableAlias=todos1_,className=com.mbs.model.domainobjects.documentation.Todo,classAlias=todos}
| +-[ALIAS_REF] IdentNode: 'todos1_.ID' {alias=todos, className=com.mbs.model.domainobjects.documentation.Todo, tableAlias=todos1_}
| \-[IDENT] IdentNode: 'done' {originalText=done}
\-[IDENT] IdentNode: 'integer' {originalText=integer}

Here is the mapping file for Todo:
Quote:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping auto-import="true">
<class name="com.mbs.model.domainobjects.documentation.Todo" table="TODOS" >
<id name="id" column="ID" type="int" unsaved-value="-1" access="field">
<generator class="identity"/>
</id>
<version name="version" column="VERSION" unsaved-value="negative" access="field"/>
<property name="companyId" column="COMPANY_ID" not-null="true" access="field"/>
<property name="createDate" column="CREATE_DATE" not-null="true" type="date"/>
<property name="userId" column="USER_ID" not-null="true"/>
<property name="summary" column="SUMMARY" not-null="true"/>
<property name="done" column="DONE" access="field" type="boolean"/>
<property name="dateDone" column="DATE_DONE" type="date" access="field"/>
<property name="patientId" column="PATIENT_ID" not-null="true"/>
<property name="account" column="ACCOUNT" />
<property name="note" column="NOTE" />
<property name="treatmentCourseId" column="TREATMENT_COURSE_ID" />
<property name="serviceLineId" column="SERVICE_LINE_ID" />
</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 16, 2005 3:24 pm 
Beginner
Beginner

Joined: Thu Feb 03, 2005 10:42 pm
Posts: 30
I am still banging my head into this one. I can't seem to get cast to work in any situation so there must be something foolish i am doing wrong.

Does anyone have any insight?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 15, 2008 7:44 am 
Beginner
Beginner

Joined: Thu May 17, 2007 8:37 am
Posts: 22
Location: London
Did you (or anyone else) ever find a solution for this? I am encountering the same issue while trying to do a very basic cast.

Thanks,

Damian.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.