Hi Marc,

Try:

load(emailAddress = arguments.emailAddress)



Marc wrote:
Hi Everyone,

I'm totally brain-dead on this, and I bet the answer is simple...

I am using ColdSpring/Reactor (with fusebox 3, but that doesn't matter).

I have a PersonService.cfc that has a function,
getPersonByEmailAddress(String emailAddress).

emailAddress is NOT the primary key in my Person database table.

If, within getPersonByEmailAddress(), I use
personGateway.getByFields(emailAddress=arguments.emailAddress), as expected
I get back a query instead of an actual Person object.  The query has the
person I'm testing with, so I know things are working up to that point.

But I want my getPersonByEmailAddress() function to return a Person, not a
query.

My thought was to therefore continue to use personGateway.getByFields() to
get the id, then create a newPerson object (instance of Person) and then
load() it using the id returned in the getByFields query.

But that seems ridiculous -- hitting the database twice to get a person,
just because I need to get the person by emailAddress instead of personId.

What is the best way to do this?  What have I forgotten about reactor that
lets me get a single object based on a field other than the primary key?

Thanks,

Marc



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