-->
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.  [ 2 posts ] 
Author Message
 Post subject: list of object arrays instead of objects from hql query
PostPosted: Sun Mar 05, 2006 3:29 pm 
Beginner
Beginner

Joined: Thu Oct 27, 2005 11:53 am
Posts: 42
Hibernate version:
3.1.2



<hibernate-mapping package="com.myvision.model">
<class name="TableModel" table="tablemodel" lazy="true">
<set name="fieldList">
<key column="parenttableModelId"/>
<one-to-many class="com.myvision.model.Field"/>
</set>
</class>
</hibernate-mapping>

<hibernate-mapping package="com.myvision.model">
<class name="Field" table="field" lazy="true">
<many-to-one name="fieldType" class="com.myvision.model.FieldType" column="fieldTypeId"/>dFieldId"/>
</class>
</hibernate-mapping>


<hibernate-mapping package="com.myvision.model">
<class name="FieldType" table="fieldtype" lazy="true">
<property name="name"/>
</class>
</hibernate-mapping>

Hello,

When i list the following query i get a list of object arrays instead of a list of objects i look for.

from TableModel tableModel join tableModel.fieldList fieldList
where
tableModel.name='Field'
or
fieldList.fieldType.name='yesNo'

The list contains object arrays of length 2. Every array contains one Field object and one TableModel object. I was hoping to get a list with tableModels.

the sql is
Hibernate:
select
tablemodel0_.id as id0_0_,
fieldlist1_.id as id3_1_,
tablemodel0_.lastModified as lastModi2_0_0_,
tablemodel0_.creationDate as creation3_0_0_,
tablemodel0_.version as version0_0_,
tablemodel0_.defaultValue as defaultV5_0_0_,
tablemodel0_.fixHeader as fixHeader0_0_,
tablemodel0_.groupBy as groupBy0_0_,
tablemodel0_.inDescriptor as inDescri8_0_0_,
tablemodel0_.name as name0_0_,
tablemodel0_.subTablesHeight as subTabl10_0_0_,
tablemodel0_.descriptorFieldId as descrip11_0_0_,
tablemodel0_.defaultQueryId as default12_0_0_,
tablemodel0_.quickSearchQueryId as quickSe13_0_0_,
fieldlist1_.lastModified as lastModi2_3_1_,
fieldlist1_.creationDate as creation3_3_1_,
fieldlist1_.version as version3_1_,
fieldlist1_.defaultValue as defaultV5_3_1_,
fieldlist1_.inDescriptor as inDescri6_3_1_,
fieldlist1_.name as name3_1_,
fieldlist1_.ordr as ordr3_1_,
fieldlist1_.showInTable as showInTa9_3_1_,
fieldlist1_.sortDown as sortDown3_1_,
fieldlist1_.fieldTypeId as fieldTy11_3_1_,
fieldlist1_.fieldCollectionId as fieldCo12_3_1_,
fieldlist1_.parentTableModelId as parentT13_3_1_,
fieldlist1_.calculatedFieldId as calcula14_3_1_
from
tablemodel tablemodel0_
inner join
field fieldlist1_
on tablemodel0_.id=fieldlist1_.parenttableModelId,
fieldtype fieldtype2_
where
fieldlist1_.fieldTypeId=fieldtype2_.id
and (
tablemodel0_.name='Field'
or fieldtype2_.name='yesNo'
)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 05, 2006 7:17 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Add the select clause
Code:
select tableModel from TableModel tableModel join tableModel.fieldList fieldList
where
tableModel.name='Field'
or
fieldList.fieldType.name='yesNo'


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