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
|