Re: Want do query Object width no 1-n reference
"Bruno CROS" <[email protected]>
| Newsgroups | gmane.comp.jakarta.ojb.user |
|---|---|
| Message-ID | <[email protected]> |
Hi, Well, if you have made a DB index on table "Group" strating with the foreign key of Users, it's necessary the fatest query. By "Query anything light", i mean, field is not important, putting something useless don't let any doubt on the utility of this (sub)query. On 12/7/06, Vasily Ivanov <[email protected]> wrote: > > Hello, > > I usually do criteria.addNotExists(subQuery) with > ReportQueryByCriteria subQuery and set subQuery.setAttributes(new > String[] { "1" }), it should be even faster than "anything ligth of > Group (key field by example)". > > Cheers, > Vasily > > On 12/7/06, Bruno CROS <[email protected]> wrote: > > Well, try notExists criteria and a subquery on Group returning anything > > ligth of Group (key field by example) > > > > Bruno. > > > > On 12/6/06, Josef Wagner <[email protected]> wrote: > > > > > > Hello List, > > > > > > I want to have all "Users", which are not in a "Group" > > > > > > Here my repository: > > > > > > <class-descriptor class="de.on_ergy.lakon.data.model.User" > table="user"> > > > <field-descriptor name="objId" column="obj_id" > > > jdbc-type="INTEGER" primarykey="true" > > > autoincrement="true"></field-descriptor> > > > <field-descriptor name="username" column="user_name" > > > jdbc-type="VARCHAR" length="100" ></field-descriptor> > > > <!-- m - n über benutzer_gruppen zu gruppen --> > > > <collection-descriptor > > > name="groups" > > > > > > collection-class=" > > > org.apache.ojb.broker.util.collections.ManageableArrayList" > > > element-class-ref="de.on_ergy.lakon.data.model.Group" > > > auto-retrieve="true" > > > auto-update="false" > > > auto-delete="link" > > > proxy="true" > > > indirection-table="user_group" > > > > > > > <fk-pointing-to-this-class column="user_obj_id"/> > > > <fk-pointing-to-element-class column="group_obj_id"/> > > > </collection-descriptor> > > > </class-descriptor> > > > > > > How can I get all Users, which currently not in a Group? > > > Is there a way like this? > > > Criteria crit = new Criteria(); > > > crit.addIsNull("groups"); > > > > > > Thanks a lot for your help! > > > > > > regards > > > > > > -- > > > Josef Wagner > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [email protected] > > > For additional commands, e-mail: [email protected] > > > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >