Bruce, This makes a lot of sense. Damn, I should have thought about this.
Thanks a lot, - Yi --- Bruce Snyder <[EMAIL PROTECTED]> wrote: > This one time, at band camp, Yi Jiang said: > > YJ>Bruce, > YJ>I was trying to simplify the question with faked > YJ>objects, here is the real ones, > YJ> > YJ>mapping file: > YJ><class name="jdo.Reminder" identity="id" > YJ>key-generator="UUID"> > YJ><description>TJDO Object for the Entity > YJ>'reminder'</description> > YJ><map-to table="reminder_t" /> > YJ><field name="id" type="string" get-method="getId" > YJ>set-method="setId"> > YJ><sql name="id" type="varchar" /> > YJ></field> > YJ><field name="remindertext" type="string" > YJ>get-method="getRemindertext" > YJ>set-method="setRemindertext" required="false"> > YJ><sql name="f_remindertext" type="varchar" /> > YJ></field> > YJ><field name="title" type="string" > YJ>get-method="getTitle" set-method="setTitle" > YJ>required="false"> > YJ><sql name="f_title" type="varchar" /> > YJ></field> > YJ><field name="kind" type="integer" > get-method="getKind" > YJ>set-method="setKind" required="false"> > YJ><sql name="f_kind" type="integer" /> > YJ></field> > YJ><field name="status" type="integer" > YJ>get-method="getStatus" set-method="setStatus" > YJ>required="false"> > YJ><sql name="f_status" type="integer" /> > YJ></field> > YJ><field name="medication" type="jdo.Medication" > YJ>set-method="setMedication" > get-method="getMedication"> > YJ><sql name="medication_id" /> > YJ></field> > YJ><field name="createdby" type="jdo.User" > YJ>set-method="setCreatedby" > get-method="getCreatedby"> > YJ><sql name="createdby_id" /> > YJ></field> > YJ><field name="events" type="jdo.Reminderevent" > YJ>set-method="setEvents" get-method="getEvents" > YJ>collection="map"> > YJ><sql many-key="reminder_events_ref" /> > YJ></field> > YJ><field name="foruser" type="jdo.User" > YJ>set-method="setForuser" get-method="getForuser"> > YJ><sql name="foruser_id" /> > YJ></field> > YJ><field name="recurrence" type="jdo.Recurrence" > YJ>set-method="setRecurrence" > get-method="getRecurrence"> > YJ><sql name="recurrence_id" /> > YJ></field> > YJ></class> > YJ> > YJ><class name="jdo.Reminderevent" identity="id" > YJ>key-generator="UUID"> > YJ><description>JDO Object for the Entity > YJ>'reminderevent'</description> > YJ><map-to table="reminderevent_t" /> > YJ><field name="id" type="string" get-method="getId" > YJ>set-method="setId"> > YJ><sql name="id" type="varchar" /> > YJ></field> > YJ><field name="targeteddatetime" type="date" > YJ>get-method="getTargeteddatetime" > YJ>set-method="setTargeteddatetime" > required="false"> > YJ><sql name="f_targeteddatetime" type="timestamp" > /> > YJ></field> > YJ><field name="response" type="integer" > YJ>get-method="getResponse" set-method="setResponse" > YJ>required="false"> > YJ><sql name="f_response" type="integer" /> > YJ></field> > YJ><field name="reminder" type="jdo.Reminder" > YJ>set-method="setReminder" > get-method="getReminder"> > YJ><sql name="reminder_events_ref" /> > YJ></field> > YJ></class> > YJ> > YJ>Basically, Reminderevent has a reference to > Reminder > YJ>object. By giver jdo.User and time, I am trying > query > YJ>the Reminderevent objects, here is the query I > was > YJ>trying and could not get it to work, > YJ> > YJ>SELECT e FROM jdo.Reminderevent e > YJ>jdo.Reminder r WHERE r.foruser= $1 AND r.status = > $2 > YJ>AND e.reminder.id = r.id AND e.targeteddatetime > >= $3 > > Yi, > > Based on what you're trying to query, you should > probably take a > look at Castor's support for nested attributes: > > http://www.castor.org/nested-attr.html > > Just off the top of my head, the query might be > something similar > to the following: > > select e from jdo.Reminderevent e > where e.reminder.foruser = $1 and > e.reminder.status = $2 and > e.reminder.id = $3 and > e.targeteddatetime >= $3 > > Of course, you will probably need to tweak this to > work correctly > with your object model. > > Bruce > -- > > perl -e 'print > unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");' > > ----------------------------------------------------------- > > If you wish to unsubscribe from this mailing, send > mail to > [EMAIL PROTECTED] with a subject of: > unsubscribe castor-dev > __________________________________________________ Do you Yahoo!? Yahoo! News - Today's headlines http://news.yahoo.com ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
