Return-Path: Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 49205 invoked from network); 13 Feb 2003 17:15:13 -0000 Received: from ntexchange.profilesys.com (HELO nt?exchange.prf.com) (65.118.130.99) by daedalus.apache.org with SMTP; 13 Feb 2003 17:15:13 -0000 Received: by nt_exchange with Internet Mail Service (5.5.2656.59) id ; Thu, 13 Feb 2003 12:09:45 -0500 Message-ID: From: "Campbell, Justin" To: 'Turbine Torque Users List' Subject: RE: AW: Copy criteria object Date: Thu, 13 Feb 2003 12:09:41 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Marc - Allow me to prefix this message with a disclaimer: I don't really = recommend modifying things at this level. Now, on to how to actually do it :) You can modify the velocity templates that Torque uses to generate your = Java source. They're found in "src/templates/om" beneath your root = Torque-install directory. For Torque 3.0.0, on line 54-55 you'll see something like = this: public abstract class $basePrefix${table.JavaName}Peer extends $table.BasePeer You can then change the "extends" statement to be whatever you like. Be = sure to change the import statements earlier in the template to include = whatever class it is you've created, as well. Hope this helps and best of luck. Justin Campbell Project Technical Lead Profile Systems, Inc. -----Original Message----- From: Marc Lustig [mailto:mail@marclustig.com] Sent: Thursday, February 13, 2003 12:05 PM To: Turbine Torque Users List Subject: AW: AW: Copy criteria object J=FCrgen, do I understand you correct, you extended Torque's BasePeer class and = added custom functionality? This is something that I also wanted to do, not only for BasePeer, but = also for BaseObject. But I wonder how do you tell Torque to use your Peer class when = generating the Peers, instead of BasePeer? I can't find a property in http://jakarta.apache.org/turbine/torque-3.0.0/properties-reference.html= I'm curious to know ... > -----Urspr=FCngliche Nachricht----- > Von: J=FCrgen Hoffmann [mailto:jh@byteaction.de] > Gesendet: Donnerstag, 13. Februar 2003 15:44 > An: 'Turbine Torque Users List' > Betreff: AW: AW: Copy criteria object > > > Hi, > > Thanx a lot for cheering me up this morning, but I actually found a > solution for the problem. > > This is how (my Extended BasePeer): > public static long getNumberOfRowsInTable(String table, Criteria > c) throws TorqueException, DataSetException > { > c.addSelectColumn("COUNT(*)"); > String query =3D createQueryString(c); > Log.debug("Query: " + query); > c.getSelectColumns().clear(); > Log.debug("Query with original Criteria: " + > createQueryString(c)); > return > ((Record)executeQuery(query).get(0)).getValue(1).asLong(); > } > > I bet you see where the trick is ;) > (All the logs were just for debugging purposes) > > P.S. Anyone interested in a lazy_paging macro for Globalmacros? And a > Patch for BasePeer to support this homegrown? > > Kind regards > > J=FCrgen Hoffmann > ByteACTION GmbH > > cert. Perl Programmer > cert. Linux System Administrator > cert. Java Programmer > > Besuchen Sie uns doch auf der CeBIT 2003 > in Halle 4/Stand 70 > > > -----Urspr=FCngliche Nachricht----- > Von: peter riegersperger [mailto:rick@subnet.at] > Gesendet: Donnerstag, 13. Februar 2003 11:40 > An: Turbine Torque Users List > Betreff: Re: AW: Copy criteria object > > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > [...] > > > Which is correct. Then I want to use a "copy" of the criteria = object > > > > and modify it like this: myCrit =3D cri.clone(); > > > myCrit.addSelectColumn("COUNT(*)"); > > > Log.debug(WebserverDailyPeer.createQueryString(cri)); > > > > > > But then I get: > > > SELECT COUNT(*) FROM webserver_daily WHERE > > > webserver_daily.DAY=3D'(UNIX_TIMESTAMP(webserver_daily.DAY) = between > > > 1009839600 and 1041375600 )' AND webserver_daily.KID=3D3 > > apparently, Criteria does not implement clone(). > if it cheers you up, you're not alone: > = http://www.mail-archive.com/turbine-torque-user@jakarta.apache.org/msg01= > 480.html > > (probably you find something useful for you in this thread) > > i ended up working around this problem by creating a specific query = for > Counts, either with Criteria (it should work if you just use the > Criteria one > time), or with the village objects themself. > > rick > > > - -- > |- > | peter riegersperger > |- > | ein windows switcher tagebuch: > |http://forum.subnet.at/viewforum.php?f=3D22 > |- > | subnet > | platform for media art and experimental technologies > |- > | http://www.subnet.at/ > |- > | muehlbacherhofweg 5 // 5020 salzburg // austria > |- > | fon/fax +43/662/842 897 > |- > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.0.7 (GNU/Linux) > > iD8DBQE+S3X4IMP39JYOy9IRAh6YAKDYqPN9i23ZLVRWMi2WjJ93JQDfMgCfT9Ea > sj1QPXpekJEMzf2anbyMO9U=3D > =3DYFuR > -----END PGP SIGNATURE----- > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org > For additional commands, e-mail: torque-user-help@db.apache.org > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org > For additional commands, e-mail: torque-user-help@db.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org For additional commands, e-mail: torque-user-help@db.apache.org