db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anthony Zepezauer <azepeza...@you.net>
Subject Re: Criteria object doesn't generate SQL.
Date Thu, 12 Jul 2012 18:22:27 GMT

some small edits:

I'm having a very confusing problem, hoping somebody here can shed some
light.  Here's the snippet where it occurs:

<code>
Criteria tCrit = getCriteria();

tCrit.addIn(TRetailerCouponPeer.RETAILER_COUPON_ID, retailerCouponIds);
tCrit.addJoin(TRetailerCouponPeer.RETAILER_COUPON_ID,
ArchTUserRetailerCouponPeer.RETAILER_COUPON_ID);
tCrit.add(ArchTUserRetailerCouponPeer.USER_RETAILER_ID,
retailerCardInfo.getId());
tCrit.add(TRetailerCouponPeer.CHAINED_TO_COUPON_ID, (Object) null,
Criteria.ISNULL);
tCrit.addJoin(TRetailerCouponPeer.RETAILER_COUPON_ID,
TRetailerCouponMetadataPeer.RETAILER_COUPON_ID);
tCrit.addDescendingOrderByColumn(ArchTUserRetailerCouponPeer.REDEEM_DATE);
tCrit.addDescendingOrderByColumn(ArchTUserRetailerCouponPeer.TAKE_DATE);

        mLogger.info("SQL: " ["+tCrit+"]");

try {
return
ArchTUserRetailerCouponPeer.doSelectJoinTRetailerCouponAndTRetailerCouponMetadata(tCrit);
} catch (TorqueException e) {
mLogger.error("Unable to select user coupons", e);
returnnull;
}
</code>

when I run this code on my local build, it runs fine, and the output from
the log statement looks like this:

<code>
SQL: [Criteria::
arch_t_user_retailer_coupon.USER_RETAILER_ID<=>arch_t_user_retailer_coupon.USER_RETAILER_ID=20067:

t_retailer_coupon.CHAINED_TO_COUPON_ID<=>t_retailer_coupon.CHAINED_TO_COUPON_ID
IS NULL :  
Current Query SQL (may not be complete or applicable): SELECT  FROM
arch_t_user_retailer_coupon, t_retailer_coupon, t_retailer_coupon_metadata
WHERE arch_t_user_retailer_coupon.USER_RETAILER_ID=20067 AND
t_retailer_coupon.CHAINED_TO_COUPON_ID IS NULL  AND
t_retailer_coupon.RETAILER_COUPON_ID=arch_t_user_retailer_coupon.RETAILER_COUPON_ID
AND
t_retailer_coupon.RETAILER_COUPON_ID=t_retailer_coupon_metadata.RETAILER_COUPON_ID
ORDER BY arch_t_user_retailer_coupon.REDEEM_DATE DESC,
arch_t_user_retailer_coupon.TAKE_DATE DESC]
</code>

But, when I check in my code, build and run it on a shared DEV server, the
output looks like this:

<code>
SQL: [Criteria::
arch_t_user_retailer_coupon.USER_RETAILER_ID<=>arch_t_user_retailer_coupon.USER_RETAILER_ID=20067:

t_retailer_coupon.CHAINED_TO_COUPON_ID<=>t_retailer_coupon.CHAINED_TO_COUPON_ID
IS NULL :  
Current Query SQL (may not be complete or applicable): ]
</code>

Note that the entire 'Current Query SQL' is missing.  And then the actual
join fails.  (I can post the stack trace if desired, but IMHO it's
irrelevant because the problem has already occurred - the join is failing
because there's no SQL to execute.) 

SVN confirms that the code is identical in both cases, including schema.xml. 
The DB being connected to is the same in both cases.

So, can anybody shed any light on why the Criteria object would generate the
SQL in one case and not the other?

Again, I can send the stack trace or any other info that might be helpful.
-- 
View this message in context: http://old.nabble.com/Criteria-object-doesn%27t-generate-SQL.-tp34152440p34152451.html
Sent from the Apache DB - Torque Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message