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/


Reply via email to