What did you change in the load() method? I changed the read() method, but
it would be better to change it on a more higher level (ala the load()
method). 

/Cody 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chris
Terrebonne
Sent: Tuesday, February 21, 2006 11:26 AM
To: [email protected]
Subject: RE: [Spam] RE: [Reactor For CF] [Spam] Mapping question

You're not alone with this issue.  I ran into this a couple of weeks ago.
There didn't appear to be much interest in it at that point so I just
switched to specifying the relation directly in the load() method.  

Hopefully you will have more luck getting this corrected...

Chris

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Cody
Caughlan
Sent: Tuesday, February 21, 2006 12:53 PM
To: [email protected]
Subject: RE: [Spam] RE: [Reactor For CF] [Spam] Mapping question

I have traced the culprit down to the UserDao.read() in my project folder.
Since my "arguments.fieldList" is blank, the <cfelse> kicks in and it looks
like this:

                        <cfset qRead = UserGateway.getByFields(
                                ID = arguments.to.ID
                        ) />

If I change this to:

                        <cfset qRead = UserGateway.getByFields(
                                PersonID = arguments.to.PersonID
                        ) /> 

Then the query uses the appropriate value and it works. In looking at the
hint for the UserRecord.load() method it says:

"I load the User record.  All of the Primary Key values must be provided for
this to work"

I think this might be the clue. In this case the column in my "User" table
which links back to the "Person" table it not the primary key but a foreign
key. I dont think this should make a difference since there is still a
1-to-1 relationship.

How can I get the UserDao.read() to refer to the correct column? Isnt this
the information that is in the XML in the first place?

Thanks
/Cody



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Cody
Caughlan
Sent: Tuesday, February 21, 2006 9:27 AM
To: [email protected]
Subject: RE: [Spam] RE: [Reactor For CF] [Spam] Mapping question

My PersonRecord.getUserRecord() looks like this:

        <cffunction name="getUserRecord" access="public" output="false"
returntype="reactor.project.Meridian_M1.Record.UserRecord">
                <cfif NOT IsDefined("variables.UserRecord")>
                        <cfset variables.UserRecord =
_getReactorFactory().createRecord("User") />
                        
                        <cfset variables.UserRecord.load() />
                </cfif>
                
                <cfreturn variables.UserRecord />
        </cffunction>

Its doing a "load" w/o an ID, so of course its going to return an empty
bean. And yes, you're right, the query should be doing a lookup on the
User.PersonID column and not User.ID. I am not really sure where to
trouble-shoot this.

/cody

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Doug
Hughes
Sent: Monday, February 20, 2006 6:12 PM
To: [email protected]
Subject: RE: [Spam] RE: [Reactor For CF] [Spam] Mapping question

So, you've got this query that's the issue:

SELECT
 [User].[ID] AS [ID]
, [User].[PersonID] AS [PersonID]
, [User].[UserName] AS [UserName]
, [User].[Password] AS [Password]
, [User].[ChangePassOnLogin] AS [ChangePassOnLogin]

FROM
 [Meridian].[dbo].[User] AS [User]
WHERE
                                                
 [User].[ID] = ?

According to the output, your parameter is set to 0

"Query Parameter Value(s) -
Parameter #1(cf_sql_integer) = 0"

I'm wondering if you loaded your person.  (It would appear so, the person.id
parameter is set to 3.)

Assuming your second query is a result of calling person.getUserRecord(),
That second query should look like this:

SELECT
 [User].[ID] AS [ID]
, [User].[PersonID] AS [PersonID]
, [User].[UserName] AS [UserName]
, [User].[Password] AS [Password]
, [User].[ChangePassOnLogin] AS [ChangePassOnLogin]

FROM
 [Meridian].[dbo].[User] AS [User]
WHERE
                                                
 [User].[PersonID] = ?

What's the code in your project PersonRecord's getUserRecord() method look
like?

Doug

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Cody
Caughlan
Sent: Monday, February 20, 2006 9:04 PM
To: [email protected]
Subject: [Spam] RE: [Reactor For CF] [Spam] Mapping question

No, in our case a there is only a 1-to-1 mapping between Person / Users.
Now, this isnt a normalized design and I re-did my DB/reactor.xml to use a
"UserPersonLink" table and I got this to work in Reactor (but it kind of
sucks to have to use a "getUserPersonLinkIterator.getQuery()" when you know
you are only getting one row from this link table and then shove this
"UserID" off to the UserRecord.setID() method....

I wanted to get my original design going because it seems so simple and its
better to start small, right?

Anyways, I referred back to my original reactor.xml and put the cfabort in
the abstractGateway.cfc method, this is what it returns:

SELECT [Person].[ID] AS [ID] , [Person].[FirstName] AS [FirstName] ,
[Person].[MiddleInit] AS [MiddleInit] , [Person].[LastName] AS [LastName] ,
[Person].[BirthDate] AS [BirthDate] , [Person].[Gender] AS [Gender] ,
[Person].[CreationDate] AS [CreationDate] , [Person].[Approved] AS
[Approved] , [Person].[Active] AS [Active] FROM [appName].[dbo].[Person] AS
[Person] WHERE [Person].[ID] = ?


so it doesnt really return anything useful because it bombs out on the first
gateway lookup and not the second one that we want (the lookup into the User
table)...attached is my debugging output for all the queries ran..

Thanks alot!

/Cody 


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Doug
Hughes
Sent: Monday, February 20, 2006 5:47 PM
To: [email protected]
Subject: [Spam]  RE: [Reactor For CF] [Spam] Mapping question


Now, first off, wouldn't a person have many Users?  And a User would haveOne
Person?

I'd try this:

<object name="Person">
        <hasMany name="User">
                <relate from="ID" to="PersonID" />
        </hasMany >
</object>

But honestly, this shouldn't make a difference.  There must be something
simple that's going wrong here.  Like the personID is really in the person
table?  It maybe it's crossing the two generic "ID" columns. 

Any chance you can do this:  Go into the abstractGateway.cfc and throw a
cfabort right before the </cfquery> this should cause the query to be
output.  I'd love to know if there's anything weird about this.

Doug

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Cody
Caughlan
Sent: Monday, February 20, 2006 8:20 PM
To: [email protected]
Subject: [Spam]  [Reactor For CF] [Spam] Mapping question

Hello,

This is concerning MSSQL. I have 2 tables, "Person" and "User". 

Person
------
ID (int, primary key, identity)
FirstName, etc...

User
----
ID (int, primary key, identity)
PersonID (foreign key back to Person table) UserName, etc...

My reactor.xml looks like this:

        <object name="Person">
                <hasOne name="User">
                        <relate from="ID" to="PersonID" />
                </hasOne>
        </object> 


This *doesnt* work, for some unknown reason. When I add a non-primary key
field to my Person table (I tried "UserID") and I manually populate it with
the appropriate primary key ID from the "Users" table and switch my
reactor.xml to:

<relate from="UserID" to="ID" />

it *does* work. Its almost as if, if I use a non-primary key in the "object"
XML declaration it will work, but if I specify its identity column it will
not work.

When I say it "does not" work, I mean that that when I call the
PersonRecord.getUserRecord() method, the returned UserRecord is always empty
and doesnt contain the appropriate data. Yes, I made sure the keys are
correct (correct values in the DB). Note, that I *can* read the correct data
from the PersonRecord, it just breaks down when trying to read the relevant
UserRecord.

I am sure I am doing something stupid but I have been looking at this for
quite some time to no availl.

Thanks
/Cody



 

-- 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/




 

-- 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/





 

-- 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/




 

-- 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/


Reply via email to