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/