-->
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: Composite-Element criteria query
PostPosted: Fri Jan 06, 2006 2:18 am 
Beginner
Beginner

Joined: Sun Oct 16, 2005 3:07 am
Posts: 33
Location: Sydney
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3.1

<hibernate-mapping>

<class name="au.com.hothouse.toyota.redesign.beans.LocationGroupBean" table="TWR_RETAIL_LOCATION_GROUP">

<id name="id" column="LOCATION_GROUP_ID" type="java.lang.Long">
<generator class="sequence">
<param name="sequence">TWR_SEQ_RETAIL_LOCATION_GROUP</param>
</generator>
</id>

<!-- properties -->
<property name="name" column="NAME" type="java.lang.String" not-null="true"/>
<property name="title" column="TITLE" type="java.lang.String" not-null="true"/>
<property name="siteId" column="SITE_ID" type="java.lang.Integer" not-null="false"/>
<property name="deleted" column="DELETED" type="boolean" not-null="true"/>
<property name="createDate" column="CREATED" type="java.util.Date" not-null="true"/>

<bag name="locations" table="TWR_RETAIL_ORDERED_LOCATIONS" lazy="false">
<key column="LOCATION_GROUP_ID" />
<composite-element class="au.com.hothouse.toyota.redesign.beans.OrderedLocationsBean">
<property name="order" column="ORDER_NUMBER" type="int" not-null="true"/>
<many-to-one name="location" column="LOCATION_ID" class="au.com.hothouse.toyota.redesign.beans.LocationBean" lazy="false" not-null="true"/>
</composite-element>
</bag>

</class>

</hibernate-mapping>



Oracle 8

I'm trying to refer to the "locations" collection in a criteria query but I'm getting an error saying that "collection was not an association: au.com.hothouse.toyota.redesign.beans.LocationGroupBean.locations"

The query I'm using is:

return (LocationGroupBean)getSession().createCriteria(LocationGroupBean.class)
.add(Restrictions.eq("siteId", new Integer(siteId) ))
.add(Restrictions.eq("deleted", Boolean.FALSE))
.createCriteria("locations")
.add(Restrictions.eq("deleted", Boolean.FALSE))
.uniqueResult();


Why would I be getting this error when the "locations" is mapped?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 07, 2006 12:23 am 
Beginner
Beginner

Joined: Sun Oct 16, 2005 3:07 am
Posts: 33
Location: Sydney
Something to do with the fact it's a composite-element mapping and there's a bean (OrderedLocations) that links LocationGroupBean and LocationBean collection??


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.