-->
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.  [ 1 post ] 
Author Message
 Post subject: HQL questions
PostPosted: Tue Dec 12, 2006 5:07 am 
Newbie

Joined: Mon Dec 11, 2006 11:44 am
Posts: 3
Hi Guys,

I'm trying to do some "select x, y from entity" hql-queries, with strange results. would be great if someone could explain me why that is so, and what I could do better.

I've got the entities Line, MillRoll and DataPoint. Line has sets "millRolls" and "dataPoints". Line has also got an id and string property "name".
now for the queries and the results I get:

select name, speed from Line
->correct results

select millRolls from Line l where l.id=1
->correct results

select millRolls, dataPoints from Line l where l.id=1
->error: No data type for node: org.hibernate.hql.ast.tree.IdentNode \-[IDENT] IdentNode: 'dataPoints' {originalText=dataPoints}
(switching "millRolls" and "dataPoints" yields the same result with "millRolls" instead of "dataPoints")

select millRolls, l.dataPoints from Line l where l.id=1
->works, but:
-empty if line has 0 mr or 0 dp (even if there's 1 mr and 0 dp, the mr won't get returned)
-if line has 2 mr and only 1 dp: returns 2 rows with object arrays: [mr1, dp1]; [mr2, dp1]
-> dp1 returned twice

mixing entities with "primitives":
select l.millRolls, l.name from Line l where l.id=1
->Hibernate operation: could not execute query; uncategorized SQLException for SQL [select . as col_0_0_, line0_.name as col_1_0_, millrolls1_.id as id5_, millrolls1_.rollId as rollId5_, millrolls1_.width as width5_, millrolls1_.LEN as LEN5_ from Line line0_ inner join MillRoll millrolls1_ on line0_.id=millrolls1_.LINE_ID where line0_.id=12]; SQL state [37000]; error code [-11]; Unexpected token: . in statement <same sql statement...>

is there something wrong in mixing entities with primitives?

Hibernate version:
3.2.0.ga

Name and version of the database you are using:
HSQLDB 1_8_0_7

thanks,
Manuel


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

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.