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?