Which Torque version are you using ? Thomas
-----Anthony Zepezauer wrote: ----- >To: [email protected] >From: Anthony Zepezauer <[email protected]> >Date: 12.07.2012 08:22PM >Subject: Re: Criteria object doesn't generate SQL. > > 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_D >ATE); >tCrit.addDescendingOrderByColumn(ArchTUserRetailerCouponPeer.TAKE_DAT >E); mLogger.info("SQL: " ["+tCrit+"]"); try { return >ArchTUserRetailerCouponPeer.doSelectJoinTRetailerCouponAndTRetailerCo >uponMetadata(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_c >oupon.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.RETA >ILER_COUPON_ID AND >t_retailer_coupon.RETAILER_COUPON_ID=t_retailer_coupon_metadata.RETAI >LER_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_c >oupon.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.-tp34152 >440p34152451.html Sent from the Apache DB - Torque Dev mailing list >archive at Nabble.com. >--------------------------------------------------------------------- >To unsubscribe, e-mail: [email protected] For >additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
