This is regarding Transfer from SVN (updated tonight) running on
ColdFusion 8 on Mac OS X Leopard against a MySQL 5 database.

I have a table called category with 3 columns (id,name,parentid_fk).
There are 3 records in the database.  Two have a NULL parentid_fk and
the other has a parent.  id and parentid_fk are char(35) and name is
varchar(255)

I have a transfer object outlined as follows:
<object name="category" decorator="model.decorators.category">
        <id name="id" column="id" type="UUID" generate="true" />
        <property name="name" column="name" type="string" nullable="false" />
        <onetomany name="childCategory" lazy="true">
                <link to="category" column="parentid_fk" />
                <collection type="array">
                        <order property="name" order="asc" />
                </collection>
        </onetomany>
</object>

I am trying to create a TQL query that will give me the root
categories (those with a null parentid_fk value).

I have created the tql as follows:
<cfset tql = 'select child.id from category as Child left outer join
category as Parent where Parent.id is null' />
<cfset q = transfer.createQuery(tql) />
<cfset result = transfer.listByQuery(q) />
<cfdump var="#result#" />

This returns all 3 records.  It should return just the two with a NULL
in parentid_fk.  I looked at the SQL that Transfer is creating and it
is as follows:

select child.id from category Child left outer join category Parent ON
Child.id = Parent.parentid_fk AND Child.parentid_fk = Parent.id where
Parent.id is null

As you can see the join "ON" clause is incorrect.  It should be ONLY
the Child.parentid_fk = Parent.id part.  There is an extra Child.id =
Parent.parentid_fk part that shouldn't be there.

Is this a bug with Transfer or am I missing something?  I have tried
it as a manytoone (referencing the parent instead of the children) and
I have tried aliasing the tables differently, inner joins, left and
right outer joins.  Its a very simple SQL statement so I think that
Transfer is adding the extra part to the ON clause.

Any one see something that I don't?

Thanks,

Sean
--~--~---------~--~----~------------~-------~--~----~
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer

You received this message because you are subscribed to the Google Groups 
"transfer-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to