hasOne problem

1 view
Skip to first unread message

Byron

unread,
Jan 30, 2010, 5:03:23 PM1/30/10
to Reactor
Hi all.

For some reason, I having a problem with creating hasOne
relationships.

In reactor.xml:

<object name="tblParticipant">
<hasOne name="tblAccelerometer">
<relate from="ID" to="ID" />
</hasOne>
</object>

When I try:

<cfset participantRecord = createRecord('tblParticipant').load(ID=1) /
>
<cfset accRecord = participantRecord.gettblAccelerometer() />

I get the following:

Message The method gettblAccelerometer was not found in component D:
\Inetpub\wwwroot\Ladies\model\data\Record
\tblParticipantRecordmssql.cfc.

Sure enough, when looking in the project file, it is not creating the
gettblAccelerometer method.

Any ideas? I haven't had this problem before.

Byron

Pete Kucera

unread,
Jan 30, 2010, 6:15:29 PM1/30/10
to reacto...@googlegroups.com
Byron,
 
I'm shooting from the hip here, but I seem to remember having the same issue and realized that I did not have the other table object defined.  Is your tblAccelerometer defined in the reactor xml?
 
<object name="tblAccelerometer" /> will work if it doesn't have relationships of its own.
 
Good Luck.
 
Pete Kucera


--
You received this message because you are subscribed to the Google Groups "Reactor" group.
To post to this group, send email to reacto...@googlegroups.com.
To unsubscribe from this group, send email to reactor-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/reactor-users?hl=en.


Byron

unread,
Jan 30, 2010, 8:52:16 PM1/30/10
to Reactor
Pete,

Thanks for the response.

I specified the object and it did not work. I tried the reverse also
and in both cases, the relationship was not created.

byron

On Jan 30, 6:15 pm, Pete Kucera <cfapp...@gmail.com> wrote:
> Byron,
>
> I'm shooting from the hip here, but I seem to remember having the same issue
> and realized that I did not have the other table object defined.  Is your
> tblAccelerometer defined in the reactor xml?
>
> <object name="tblAccelerometer" /> will work if it doesn't have
> relationships of its own.
>
> Good Luck.
>
> Pete Kucera
>

> > reactor-user...@googlegroups.com<reactor-users%2Bunsu...@googlegroups.com>

denstar

unread,
Jan 30, 2010, 9:29:03 PM1/30/10
to reacto...@googlegroups.com
On Sat, Jan 30, 2010 at 6:52 PM, Byron wrote:
> Pete,
>
> Thanks for the response.
>
> I specified the object and it did not work. I tried the reverse also
> and in both cases, the relationship was not created.

Do you have the foreign key for tblAccelerometer set on tblParticipant?

That's all I got.

:den

--
Thinking has become a superfluous exercise... purely internal, without
compelling force, more or less a game.
Jacques Ellul

Byron

unread,
Jan 30, 2010, 10:07:01 PM1/30/10
to Reactor
Den,

For tblAccelerometer, I have Pt_ID as a primary key, for
tblParticipant, I have ID and Pt_ID as primary keys. I've also tried
it without Pt_ID as a primary key in tblParticipant. Below is the
component.

hierarchy: WEB-INF.cftags.component
reactor.base.abstractRecord
reactor.project.Ladies.Record.tblParticipantRecord
path: D:\Inetpub\wwwroot\reactor\project\Ladies\Record
\tblParticipantRecord.cfc
properties:
methods: _getDao*, _getInitialTo*, _getTo, _setDao*, _setInitialTo*,
_setTo, exists, getAddress1, getAddress2, getBestTimeToContact,
getCity, getEmail, getFirstname, getID, getLastname, getMI,
getPhoneDay, getPhoneEvening, getPhoneOther, getPt_ID, getSiteID,
getState, getStatus, getSubStudy, getZipcode, init, setAddress1,
setAddress2, setBestTimeToContact, setCity, setEmail, setFirstname,
setID, setLastname, setMI, setPhoneDay, setPhoneEvening,
setPhoneOther, setPt_ID, setSiteID, setState, setStatus, setSubStudy,
setZipcode
inherited methods: _configure, _getDictionary, _getErrorCollection,
_getObjectMetadata, _getParent, _setParent, clean, delete, dump,
hasErrors, hasParent, isDeleted, isDirty, load, populate, resetParent,
save, validate, validated

Am I messing up the keys??

byron

denstar

unread,
Jan 30, 2010, 11:17:55 PM1/30/10
to reacto...@googlegroups.com
On Sat, Jan 30, 2010 at 8:07 PM, Byron wrote:
> Den,
>
> For tblAccelerometer, I have Pt_ID as a primary key, for
> tblParticipant, I have ID and Pt_ID as primary keys.  I've also tried
> it without Pt_ID as a primary key in tblParticipant.  Below is the
> component.
...

> Am I messing up the keys??

None of those are foreign keys? Shouldn't Pt_ID be a foreign key in
tblAccelerometer, if it's the primary key in tblParticipant?

I'm not sure of your specific schema, but there should be foreign
keys. And I don't remember if composite primary keys are handled well
or not...

:Den

--
The nature of God is a circle of which the center is everywhere and
the circumference is nowhere.
Empedocles

Byron

unread,
Jan 31, 2010, 12:06:19 AM1/31/10
to Reactor
I'm using MS SQL 2008. Think there could be an issue with that?

byron

Byron

unread,
Jan 31, 2010, 12:27:11 AM1/31/10
to Reactor
Ahh, the problem with cut and paste.

Forgot the <reactor> node in the %&%&^% reactor.xml file. Shoot me
now.

Thanks for the help.

denstar

unread,
Jan 31, 2010, 2:25:11 PM1/31/10
to reacto...@googlegroups.com
On Sat, Jan 30, 2010 at 10:27 PM, Byron wrote:
> Ahh,  the problem with cut and paste.
>
> Forgot the <reactor> node in the %&%&^% reactor.xml file.  Shoot me
> now.
>
> Thanks for the help.

Done that myself before, no problemo!

:den

--
Everything must justify its existence before the judgment seat of
Reason, or give up existence.
Friedrich Engels

Tom Chiverton

unread,
Feb 1, 2010, 5:06:57 AM2/1/10
to reacto...@googlegroups.com
On Sunday 31 Jan 2010, denstar wrote:
> Done that myself before, no problemo!

Hmmm, Reactor should probably throw an error if you leave that out; issue
#206.

--

Tom Chiverton
Developer

Tom.Ch...@halliwells.com
3 Hardman Square, Manchester, M3 3EB

****************************************************

This email is sent for and on behalf of Halliwells LLP.

Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB. A list of members is available for inspection at the registered office together with a list of those non members who are referred to as partners. We use the word “partner” to refer to a member of the LLP, or an employee or consultant with equivalent standing and qualifications. Regulated by the Solicitors Regulation Authority.

CONFIDENTIALITY

This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 2500.

For more information about Halliwells LLP visit
www.Halliwells.com.

Reply all
Reply to author
Forward
0 new messages