| Message | Error with class value 'parent' in clause |
| Detail | Class values must resolve to the Class name or the alias. e.g. 'email.Email.emailName' |
| Extended Info | |
| Tag Context |
C:\webApps\frameworks\transfer\com\tql\walkers\AbstractBaseWalker.cfc (124) C:\webApps\frameworks\transfer\com\tql\walkers\Object.cfc (38) C:\webApps\frameworks\transfer\com\tql\walkers\Join.cfc (261) C:\webApps\frameworks\transfer\com\tql\walkers\Join.cfc (306) C:\webApps\frameworks\transfer\com\tql\walkers\Join.cfc (306) C:\webApps\frameworks\transfer\com\tql\walkers\Join.cfc (50) C:\webApps\frameworks\transfer\com\tql\walkers\From.cfc (133) C:\webApps\frameworks\transfer\com\tql\walkers\From.cfc (57) C:\webApps\frameworks\transfer\com\tql\walkers\From.cfc (91) C:\webApps\frameworks\transfer\com\tql\SelectStatement.cfc (232) C:\webApps\frameworks\transfer\com\tql\SelectStatement.cfc (154) C:\webApps\frameworks\transfer\com\tql\SelectStatement.cfc (101) C:\webApps\frameworks\transfer\com\tql\TQLManager.cfc (28) C:\webApps\frameworks\transfer\com\Transfer.cfc (471) C:\webApps\medlien\model\users\userService.cfc (659) C:\webApps\medlien\controller\userController.cfc (206) C:\webApps\frameworks\ModelGlue\unity\listener\Listener.cfc (26) C:\webApps\frameworks\ModelGlue\unity\eventrequest\MessageBroadcaster.cfc (32) C:\webApps\frameworks\ModelGlue\unity\framework\ModelGlue.cfc (332) C:\webApps\frameworks\ModelGlue\unity\framework\ModelGlue.cfc (290) C:\webApps\frameworks\ModelGlue\unity\framework\ModelGlue.cfc (263) C:\webApps\frameworks\ModelGlue\unity\ModelGlue.cfm (75) C:\webApps\medlien\webroot\index.cfm (33) C:\webApps\medlien\webroot\Application.cfc (52) |
from post.Post as Post
join user.User
ON Post.Author
Your join syntax looks wrong. If you're specifying the relationship it needs to look likefrom post.Post as Post
join user.User
ON Post.Author
You may want to consult the documentation as there are several syntaxes for doing joins.
Since you have only one join to the same table and not two as the team example demonstrates, can you try the tql without the "ON parent" portion, just for kicks?
One other thing, if parentID is set to 0 as a default, I don't think you need to use a LEFT OUTER JOIN as the field is not NULL.
What is the error here? The auto join should actually work....? Can
you let me know, that may be a bug.
If you are using a specific join, and are using the ON statement, you
MUST specify which class you are referring to when specifying a
composition name.
I.e.
SELECT org.orgName,org.orgID,parentOrg.orgID AS
parentID,parentOrg.orgName AS parentName
parentOrg ON parent
won't work as the when TQL reads this: ON parent, it assumes that
'parent' is a class name, and tries to resolve it as such.
Hence the error:
Class values must resolve to the Class name or the alias. e.g.
'email.Email.emailName'
(tho' that should read 'their')
You ON statement should read:
FROM users.org AS org LEFT OUTER JOIN users.org AS parentOrg ON org.parent
without specifying which class the composition refers to, TQL has no
way to knowing how to resolve it.
You can see in the documentation, specific joins read:
from class [as classAlias] join class [as classAlias] ON ( class |
classAlias ).composite [ ( and | or ) ( class | classAlias ).composite
]*
I hope that makes more sense.
Regards,
Mark
SELECT org.orgName,org.orgID,parentOrg.orgID AS
parentID,parentOrg.orgName AS parentName
parentOrg ON parent
won't work as the when TQL reads this: ON parent, it assumes that
'parent' is a class name, and tries to resolve it as such.
You ON statement should read:
FROM users.org AS org LEFT OUTER JOIN users.org AS parentOrg ON org.parent
Quick one to go back on:
You said you tried:
<cfsavecontent variable="qList">
SELECT org.orgName,org.orgID,parent.orgID AS
parentID,parent.orgName AS parentName
FROM users.org AS org LEFT OUTER JOIN users.org AS parent
<cfif NOT arguments.includeInactive>WHERE
org.isInactive = :inactive</cfif>
ORDER BY parent.orgName,parent.orgID, org.orgName
</cfsavecontent>
And got an error? what was the error? This should have worked, so I
want to know if I have a bug.
On Jan 26, 2008 10:25 AM, Tom McNeer <tmc...@gmail.com> wrote:
> Hi Mark,
>
> I figured I'd hear from you soon. I'm always amazed at how willing you are
> to help.
You're very welcome ;)
> > You ON statement should read:
> > FROM users.org AS org LEFT OUTER JOIN users.org AS parentOrg ON org.parent
>
>
> I understand what you're saying, and why. But help walk me through this,
> please: currently, "parent" is not defined as a class or alias in the XML.
> It's simply the name of a manytoone relationship that joins back to the
> users.org table on the parentID field.
Yes, that is totally correct.
>
>
> <object name="org" table="Orgs">
> <id name="OrgID" type="numeric" />
> (... fields omitted)
>
> <manytoone name="parent" lazy="true">
> <link to="users.org" column="parentID" />
> </manytoone>
> </object>
>
> So -- is it possible to make a join with this manytoone relationship only?
Yes, these are called 'specific joins' as outlined in the documentation.
Did you try it? did it not work ;) ?
Mark
<cfsavecontent variable="qList">And got an error? what was the error? This should have worked, so I
SELECT org.orgName,org.orgID,parent.orgID AS
parentID,parent.orgName AS parentName
FROM users.org AS org LEFT OUTER JOIN users.org AS parent
<cfif NOT arguments.includeInactive>WHERE
org.isInactive = :inactive</cfif>
ORDER BY parent.orgName,parent.orgID, org.orgName
</cfsavecontent>
want to know if I have a bug.
Now what happens when you do the Specific Join that we talked about
earlier in this post? Once the fix for your TQL is in place, does that
work? (It should)
Mark
Now what happens when you do the Specific Join that we talked about
earlier in this post? Once the fix for your TQL is in place, does that
work? (It should)
No, you shouldn't need it. Like I said, have you actually TRIED what
I suggested?
> Without that, I don't have a class to join against. And since all I'm really
> looking for at this point is a query object with Orgs and their Parents,
> it's much easier (and cleaner, I think) to simply do straight SQL.
You can join it against another instance of itself, just aliased
differently like you had originally.
>
> When I retrieve an individual Org, I'll still have all the data about its
> parent from the original manytoone relationship. Going to the trouble of
> having the duplicate object just to get a simple list seems to be going
> about things the hard way.
Agreed, hence what I am saying above.
Mark
No, you shouldn't need it. Like I said, have you actually TRIED what
I suggested?
Glad we got there in the end, and you got the result that you wanted :oD
Mark