Hi Mark
I assume you mean the generated SQL in the CF debug? If so please see
below (both queries return data in SQL client):
*** QUERY 1 ***
SELECT testUser_1.firstName, testUser_1.userId, NULL as
transfer_parentKey, 1 as transfer_orderIndex,'User' as
transfer_className,'' as transfer_parentClassName,'' as
transfer_parentParentClassName,'' as
transfer_parentCompositeName,'false' as transfer_isArray,'' as
transfer_compositeName, 'false' as transfer_isProxied
FROM testUser testUser_1
WHERE testUser_1.userId = 1
AND testUser_1.userId IS NOT NULL
ORDER BY transfer_orderIndex ASC
*** QUERY 2 ***
SELECT testUser_1.firstName, NULL as deliveryName, NULL as
totalPrice, testUser_1.userId, NULL as orderId, NULL as
transfer_parentKey, 1 as transfer_orderIndex,'User' as
transfer_className,'' as transfer_parentClassName,'' as
transfer_parentParentClassName,'' as
transfer_parentCompositeName,'false' as transfer_isArray,'' as
transfer_compositeName, 'false' as transfer_isProxied
FROM testUser testUser_1
WHERE testUser_1.userId = 1
AND testUser_1.userId IS NOT NULL
UNION ALL
SELECT NULL as firstName, testOrder_2.deliveryName,
testOrder_2.totalPrice, testOrder_2.userId, testOrder_2.orderId, CAST
(testUser_1.userId as varchar(1000)) as transfer_parentKey, 2 as
transfer_orderIndex,'Basket' as transfer_className,'User' as
transfer_parentClassName,'' as transfer_parentParentClassName,'' as
transfer_parentCompositeName,'true' as transfer_isArray,'UserBaskets'
as transfer_compositeName, 'false' as transfer_isProxied
FROM testUser testUser_1
INNER JOIN testOrder testOrder_2 ON testUser_1.userId =
testOrder_2.userId
WHERE testUser_1.userId = 1
AND testOrder_2.orderId IS NOT NULL
UNION ALL
SELECT testUser_3.firstName, NULL as deliveryName, NULL as
totalPrice, testUser_3.userId, NULL as orderId, CAST
(testOrder_2.orderId as varchar(1000)) as transfer_parentKey, 3 as
transfer_orderIndex,'User' as transfer_className,'Basket' as
transfer_parentClassName,'User' as
transfer_parentParentClassName,'UserBaskets' as
transfer_parentCompositeName,'false' as transfer_isArray,'OrderUser'
as transfer_compositeName, 'false' as transfer_isProxied
FROM testUser testUser_1
INNER JOIN testOrder testOrder_2 ON testUser_1.userId =
testOrder_2.userId
INNER JOIN testUser testUser_3 ON testOrder_2.userId =
testUser_3.userId
WHERE testUser_1.userId = 1
AND testUser_3.userId IS NOT NULL
ORDER BY transfer_orderIndex ASC
I know "order" is a reserved wod but I don't think it's guilty. I've
changed Order to Basket and same error:
<object name="User" table="testUser">
<id name="userId" type="numeric"></id>
<property name="firstName" type="string" />
<onetomany name="UserBaskets" lazy="true">
<link to="Basket" column="userId" />
<collection type="array"></collection>
</onetomany>
</object>
<object name="Basket" table="testOrder">
<id name="orderId" type="numeric"></id>
<property name="userId" type="numeric" />
<property name="totalPrice" type="numeric" />
<property name="deliveryName" type="string" />
<manytoone name="OrderUser">
<link to="User" column="userId" />
</manytoone>
</object>
Cheers
Matthew
On Jun 1, 9:52 am, Mark Mandel <[email protected]> wrote:
> ..except for the fact that 'Order' is a reserved word in SQL, I bet you that
> is what is causing the issue..
>
> What is the generated SQL?
>
> Mark
>
>
>
> On Mon, Jun 1, 2009 at 9:48 AM, Matthew <[email protected]> wrote:
>
> > Hi Mark
>
> > Nope: the table isn't called Orders. I've started from scratch and
> > build 2 new tables testOrders/testUser just to issolate these objects
> > to rule out other relationships.
>
> > There's not much more in the error just "null null The error occurred
> > on line -1."
>
> > I think the problem is that CF is going into an infinite loop because
> > of recursive referencing (so perhaps to avoid crashing it just throws
> > a "null null").
>
> > To take 1 step back if you use the following XML I get this error "The
> > object 'Order' has a recursive link back to itself through composition
> > 'Orders'. You will need to set one of the elements in this chain to
> > lazy='true' for it to work.":
>
> > <object name="User" table="testUser">
> > <id name="userId" type="numeric"></id>
> > <property name="firstName" type="string" />
> > <onetomany name="Orders">
> > <link to="Order" column="userId" />
> > <collection type="array"></collection>
> > </onetomany>
> > </object>
> > <object name="Order" table="testOrder">
> > <id name="orderId" type="numeric"></id>
> > <property name="userId" type="numeric" />
> > <property name="totalPrice" type="numeric" />
> > <property name="deliveryName" type="string" />
> > <manytoone name="OrderUser">
> > <link to="User" column="userId" />
> > </manytoone>
> > </object>
>
> > When I add lazy="true" to either the o2m or m2o the page loads fine.
> > I can in fact dump the none-lazy array but if I try to dump the lazy
> > array it throws the "null null" error - e.g. if I change the XML to
> > the following and try to call getOrdersArray():
>
> > <object name="User" table="testUser">
> > <id name="userId" type="numeric"></id>
> > <property name="firstName" type="string" />
> > <onetomany name="Orders" lazy="true">
> > <link to="Order" column="userId" />
> > <collection type="array"></collection>
> > </onetomany>
> > </object>
> > <object name="Order" table="testOrder">
> > <id name="orderId" type="numeric"></id>
> > <property name="userId" type="numeric" />
> > <property name="totalPrice" type="numeric" />
> > <property name="deliveryName" type="string" />
> > <manytoone name="OrderUser">
> > <link to="User" column="userId" />
> > </manytoone>
> > </object>
>
> > Cheers
> > Matthew
>
> > On May 29, 4:17 pm, Mark Mandel <[email protected]> wrote:
> > > I don't suppose the table you are pointing at for 'Orders' name is
> > 'Order',
> > > or anything weird like that?
>
> > > Can we get the full error though?
>
> > > Mark
>
> > > On Fri, May 29, 2009 at 2:48 PM, Matthew <[email protected]>
> > wrote:
>
> > > > Hi
>
> > > > I keep getting the follow error "null null" when I try to call
> > > > get*Array() on a onetomany which is setup to lazy load.
>
> > > > The documentation says that what I've done is fine (http://
> > > > docs.transfer-orm.com/wiki/Using_Lazy_Loading.cfm) so I can't work out
> > > > what's wrong?
>
> > > > Here's my Transfer XML config:
>
> > > > <object name="User">
> > > > <id name="userId" type="numeric"></id>
> > > > <property name="firstName" type="string" />
> > > > <onetomany name="Orders" lazy="true">
> > > > <link to="Order" column="userId" />
> > > > <collection type="array"></collection>
> > > > </onetomany>
> > > > </object>
>
> > > > I'm trying to call user.getOrdersArray() but get the error. I can call
> > > > user.getUserId() and user.getFirstName() no problem.
>
> > > > Setup: Transfer 1.1, CF 7
>
> > > > Cheers
> > > > Matthew
>
> > > --
> > > E: [email protected]
> > > W:www.compoundtheory.com
>
> --
> E: [email protected]
> W:www.compoundtheory.com
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---