ok, another approach...use the gateways Luke!

<cfset gw = Reactor.createGateway('SECMAIN_SECROLE') />
<cfset foo = gw.getByfields(secrole_id=1) >
<cfdump var="#foo#">

Makes more sense even, eh?  Maybe I was thinking to majically
far-fetched before.  My guess is that folks would put a service layer
infront of some of the more complex realationships needed, the real
world rarely looks like a blog app or pet market app!.

DK


On 5/12/06, Douglas Knudsen <[EMAIL PROTECTED]> wrote:
yeah, got all the PKs in ok...me thinks they are.

this will work..have to use the link table iterator as Brian suggested.
<cfset sec2 = Reactor.createRecord('SECROLE') />
<cfset sec2.setSecrole_Id(1) />
<cfset sec2.load() />
<cfset employees = sec2.getSecmain_secroleIterator().getQuery()>
<cfdump var="#employees#">

this will list all employees in roleid 1.

I was thinking that given tables A nd B with a link/relation table C,
that I could load a record for A, set a property on this record, then
use A.GETBITERATOR() to return all B records related to A filtered by
the properties I set in A.  Is this way off?

now to figure out the add/update/delete approaches to this.

thanks Brian

DK

On 5/12/06, Brian Kotek <[EMAIL PROTECTED]> wrote:
> What about using the link table directly?
>
> <cfset role = Reactor.createRecord('SECMAIN_SECROLE') />
>
> <cfset role.setRoleID('0012345') />
> <cfset role.load() />
> <cfset emps = role.getSecmainIterator().getQuery() />
> <cfdump var="#emps#">
>
> also, are you sure all of the primary keys are set up correctly, etc?
>
>
>  On 5/12/06, Douglas Knudsen <[EMAIL PROTECTED]> wrote:
> > doesn't seem to get it.  This returns one record when I know there are
> > mulitple in the DB.
> >
> > > <cfset role = Reactor.createRecord('SECROLES') />
> > > <cfset role.setsecRole_ID('1') />
> > > <cfset role.load() />
> > > <cfset emps = role.getSecmainIterator().getQuery() />
> > > <cfdump var="#emps#">
> >
> > I thought this should return all records in secmain with
> > secrole.secrole_id = 1.  Looking at the generated SQL I found that
> > reactors SQL is joining on emplid, not secrole_id.
> >
> > "RRTPP"."SECMAIN" "SECMAIN"
> > INNER JOIN "RRTPP"."SECMAIN_SECROLE" "SECMAIN_SECROLE"
> > ON "SECMAIN"."EMPLID" = "SECMAIN_SECROLE"."EMPLID"
> >
> > How to get the join on secrole.secrole_id instead?
> >
> >
> > DK
> >
> > On 5/11/06, Brian Kotek <[EMAIL PROTECTED]> wrote:
> > > You should be able to go through using the reverse relationship,
> something
> > > like this:
> > >
> > > <cfset role = Reactor.createRecord('SECROLES') />
> > > <cfset role.setRoleID('0012345') />
> > > <cfset role.load() />
> > > <cfset emps = role.getSecmainIterator ().getQuery() />
> > > <cfdump var="#emps#">
> > >
> > > Not sure about the saving though.
> > >
> > >
> > > On 5/11/06, Douglas Knudsen <[EMAIL PROTECTED] > wrote:
> > > >
> > >  any advice?  Or URL to some?
> > >
> > > thanks!
> > > DK
> > >
> > > On 5/9/06, Douglas Knudsen <[EMAIL PROTECTED]> wrote:
> > > > ok, I'm trying to work with three tables using Reactor and the link
> > > > configuration.  I'm looking over the sample Scratch app and its just
> > > > not sinking in.  (There is a  getProductQuery() call in there that I
> > > > just can't find when I try this at home)
> > > >
> > > > Say the tables are
> > > >
> > > > SECMAIN:
> > > > emplid   VARCHAR PK
> > > > isactive   NUMBER   (using Oracle, no bool, so 1/0 here)
> > > >
> > > > SECROLE:
> > > > secrole_id   NUMBER PK
> > > > role VARCHAR
> > > >
> > > > SECMAIN_SECROLE:   a relation table
> > > > emplid  VARCHAR
> > > > secrole_id  NUMBER
> > > >
> > > > I know there are other ways to do this, but this is similar to the
> > > > product/invoice examples that I'm readin over.
> > > >
> > > > Now my reactor.xml has
> > > >
> > > > <objects>
> > > >                 <object name="SECMAIN">
> > > >                         <hasMany name="SECROLE">
> > > >                                 <link
> > > name="SECMAIN_SECROLE" />
> > > >                         </hasMany>
> > > >
> > > >                 </object>
> > > >
> > > >                 <object name="SECROLE">
> > > >                         <hasMany name="SECMAIN" >
> > > >                                 <link
> > > name="SECMAIN_SECROLE"  />
> > > >                         </hasMany>
> > > >                 </object>
> > > >
> > > >                 <object name="SECMAIN_SECROLE">
> > > >                         <hasOne name="SECMAIN">
> > > >                                 <relate from="emplid"
> > > to="emplid"/>
> > > >                         </hasOne>
> > > >                         <hasOne name="SECROLE">
> > > >                                 <relate
> from="secrole_id"
> > > to="secrole_id"/>
> > > >                         </hasOne>
> > > >                 </object>
> > > >
> > > >         </objects>
> > > >
> > > >
> > > > Now, this looks right, is it?
> > > >
> > > > I can get all roles for an emplid
> > > > <cfset sec = Reactor.createRecord ('SECMAIN') />
> > > > <cfset sec.setEmplid('0012345') />
> > > > <cfset sec.load() />
> > > > <cfset roles = sec.getSecroleIterator().getQuery() />
> > > > <cfdump var="#roles#">
> > > >
> > > > kewl.
> > > >
> > > > now, how to get all employees in a secrole?
> > > > How to go about adding a new 'entry' which involves inserts into two
> > > > tables? Do I have to perform a .save() on both the secmain object and
> > > > the secmain_secrole objects? I don't see something like
> > > > secmainobject.setSecRoleRecord().
> > > >
> > > >
> > > >
> > > > --
> > > > Douglas Knudsen
> > > > http://www.cubicleman.com
> > > > this is my signature, like it?
> > > >
> > >
> > >
> > > --
> > > Douglas Knudsen
> > > http://www.cubicleman.com
> > > this is my signature, like it?
> > >
> > >
> > >
> > > -- Reactor for ColdFusion Mailing List -- [email protected]
> > > -- Archives at
> > > http://www.mail-archive.com/reactor%40doughughes.net/
> > >
> > >
> > >
> > >  -- Reactor for ColdFusion Mailing List -- [email protected] --
> > > Archives at
> > > http://www.mail-archive.com/reactor%40doughughes.net/
> >
> >
> > --
> > Douglas Knudsen
> > http://www.cubicleman.com
> > this is my signature, like it?
> >
> >
> >
> > -- Reactor for ColdFusion Mailing List -- [email protected]
> > -- Archives at
> http://www.mail-archive.com/reactor%40doughughes.net/
> >
> >
> >
>
>  -- Reactor for ColdFusion Mailing List -- [email protected] --
> Archives at
> http://www.mail-archive.com/reactor%40doughughes.net/


--
Douglas Knudsen
http://www.cubicleman.com
this is my signature, like it?



--
Douglas Knudsen
http://www.cubicleman.com
this is my signature, like it?



-- Reactor for ColdFusion Mailing List -- [email protected]
-- Archives at http://www.mail-archive.com/reactor%40doughughes.net/


Reply via email to