Hi Kamal,

try "mStyleFlds.mStyleValues.mBrand"

in place of "style_value.brand"

Regards

Alessandro



On 12/23/07, Kamal Bhatt <[EMAIL PROTECTED]> wrote:
>
> Hi,
> I have the following tables:
> CREATE TABLE style (
>    style_id    CHARACTER VARYING (10)          NOT NULL,
>        has_links       BOOLEAN DEFAULT   (false),
>        description     CHARACTER VARYING                       NOT NULL,
>    PRIMARY KEY (style_id)
> );
>
> CREATE TABLE style_fld (
>        style_fld_id     CHARACTER VARYING (20) NOT NULL,
>    style            CHARACTER VARYING (10) NOT NULL,
>    fld_type             CHARACTER VARYING (10) NOT NULL DEFAULT 'STRING',
>    position             SMALLINT                               NOT NULL,
>        label                    CHARACTER VARYING              NOT NULL,
>        help                     CHARACTER VARYING              NOT NULL,
>        xml_elem                 CHARACTER VARYING (200) NOT NULL ,
>    PRIMARY KEY (style_fld_id)
> );
>
> CREATE TABLE style_value (
>        style_fld         CHARACTER VARYING (20)        NOT NULL,
>        brand             CHARACTER VARYING (8),
>        value             CHARACTER VARYING                     NOT NULL,
>        PRIMARY KEY (style_fld, brand)
> );
>
> I have created the following mappings:
>
> <class-descriptor class="au.com.tt.ccm.beans.Style" table="style">
> <field-descriptor name="mStyleId" column="style_id" jdbc-type="VARCHAR"
> primarykey="true" />
> <field-descriptor name="mHasLinks" column="has_links"
> jdbc-type="BOOLEAN" />
> <field-descriptor name="mDescription" column="description"
> jdbc-type="VARCHAR" />
>
> <collection-descriptor name="mStyleFlds"
> element-class-ref="au.com.tt.ccm.beans.StyleFld" auto-retrieve="true"
>    auto-update="false" auto-delete="false" orderby="position" >
>    <inverse-foreignkey field-ref="style" />
> </collection-descriptor>
> </class-descriptor>
>
> <class-descriptor class="au.com.tt.ccm.beans.StyleFld" table="style_fld">
> <field-descriptor name="mStyleFldId" column="style_fld_id"
> jdbc-type="VARCHAR" primarykey="true" />
> <field-descriptor name="style" column="style" jdbc-type="VARCHAR"
> default-fetch="true" access="anonymous" />
> <field-descriptor name="mFldType" column="fld_type" jdbc-type="VARCHAR" />
> <field-descriptor name="mPosition" column="position" jdbc-type="INTEGER"
> />
> <field-descriptor name="mLabel" column="label" jdbc-type="VARCHAR"/>
> <field-descriptor name="mHelp" column="help" jdbc-type="VARCHAR"/>
>
> <collection-descriptor name="mStyleValues"
> element-class-ref="au.com.tt.ccm.beans.StyleFldValue"
> auto-retrieve="true"
>    auto-update="false" auto-delete="false">
>    <inverse-foreignkey field-ref="style_fld" />
> </collection-descriptor>
> </class-descriptor>
>
> <class-descriptor class="au.com.tt.ccm.beans.StyleFldValue"
> table="style_value">
> <field-descriptor name="style_fld" column="style_fld"
> jdbc-type="VARCHAR" default-fetch="true" access="anonymous"
> primarykey="true"/>
> <field-descriptor name="mValue" column="value" jdbc-type="VARCHAR" />
> <field-descriptor name="mBrand" column="brand" jdbc-type="VARCHAR"
> primarykey="true"/>
> </class-descriptor>
>
> Now, I want to get all the styles, and all the associated style_flds all
> the associated style_values that match a particular brand.
>
> I was thinking something like this:
>
> Criteria crit = new Criteria();
> crit.addEqualTo("style_value.brand", inBrand.getBrandId());
> QueryByCriteria query = QueryFactory.newQuery(Style.class, crit);
> Iterator iter = broker.getIteratorByQuery(query);
>
> would work for me, but it doesn't. Unfortunately, the docs are not clear
> about what to do in this scenario. Also, I would like this to be a left
> outer join.
>
> Any help would be appreciated.
>
> Thanks.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to