As it turns out, this has been covered here before... so, just disregard this redundant question.

Answer, in case anyone wants to know, is to use a Criteria where you simply say:
Criteria c = new Criteria()
c.addEqualTo("allCategories.id","1");
(or something similar...)


Sorry for the duplicate... : )

On Tuesday, July 29, 2003, at 01:37 AM, Marcus Breese wrote:

I'm sorry for asking what may be a silly question, but is it possible to query the database using a Criteria that includes a field that is in a m:n relationship, but not intrinsically in the class.

For example:

class widget {
        Integer id
        String name

        Collection allCategories() (ojb.collection to widget_category)
}

class category {
        Integer id
        String name
        Integer parent_id
}

// indirection table/class
class widget_category {
        Integer widgetId
        Integer categoryId
}

With all of the associated tables and OJB mappings...

Is it possible to create a criteria that says "Give me all Widgets in Category X"? Or is is possible to do a "query by example"?

-=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-=-
Marcus Breese                            [EMAIL PROTECTED]
IU School of Medicine              [EMAIL PROTECTED]
Dept. of Biochemistry and Molecular Biology
Center for Medical Genomics / Grow Lab


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



-=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-=-
Marcus Breese                            [EMAIL PROTECTED]
IU School of Medicine              [EMAIL PROTECTED]
Dept. of Biochemistry and Molecular Biology
Center for Medical Genomics / Grow Lab



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to