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 81964 invoked from network); 13 Feb 2003 17:29:14 -0000 Received: from mail.bynum.com (HELO blr02.bynum.com) (64.79.231.74) by daedalus.apache.org with SMTP; 13 Feb 2003 17:29:14 -0000 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: AW: Copy criteria object X-MIMEOLE: Produced By Microsoft Exchange V6.0.6249.0 Date: Thu, 13 Feb 2003 11:29:16 -0600 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: AW: Copy criteria object Thread-Index: AcLTg306w+0w5a/PRfOHrgDMvLqePQAAcyRQ From: "Quinton McCombs" To: "Turbine Torque Users List" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N No need to do this. The database tag in your project-schema.xml file = allows for this already. > -----Original Message----- > From: Campbell, Justin [mailto:jcampbell@profilesys.com]=20 > Sent: Thursday, February 13, 2003 11:10 AM > To: 'Turbine Torque Users List' > Subject: RE: AW: Copy criteria object >=20 >=20 > Marc - >=20 > Allow me to prefix this message with a disclaimer: I don't=20 > really recommend modifying things at this level. Now, on to=20 > how to actually do it :) >=20 > You can modify the velocity templates that Torque uses to=20 > generate your Java source. They're found in=20 > "src/templates/om" beneath your root Torque-install=20 > directory. For Torque 3.0.0, on line 54-55 you'll see=20 > something like this: >=20 > public abstract class $basePrefix${table.JavaName}Peer > extends $table.BasePeer >=20 > You can then change the "extends" statement to be whatever=20 > you like. Be sure to change the import statements earlier in=20 > the template to include whatever class it is you've created, as well. >=20 > Hope this helps and best of luck. >=20 > Justin Campbell > Project Technical Lead > Profile Systems, Inc. >=20 > -----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 >=20 >=20 > J=FCrgen, > do I understand you correct, you extended Torque's BasePeer=20 > class and added custom functionality? This is something that=20 > I also wanted to do, not only for BasePeer, but also for=20 > BaseObject. But I wonder how do you tell Torque to use your=20 > Peer class when generating the Peers, instead of BasePeer? I=20 > can't find a property in=20 > http://jakarta.apache.org/turbine/torque-3.0.0/properties-refe > rence.html >=20 > I'm curious to know ... >=20 >=20 >=20 >=20 >=20 > > -----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=20 > > 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: " +=20 > 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=20 > Globalmacros? And a=20 > > 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=20 > > > > object > > > > > > and modify it like this: myCrit =3D cri.clone();=20 > > > > myCrit.addSelectColumn("COUNT(*)"); > > > > Log.debug(WebserverDailyPeer.createQueryString(cri)); > > > > > > > > But then I get: > > > > SELECT COUNT(*) FROM webserver_daily WHERE > > > >=20 > webserver_daily.DAY=3D'(UNIX_TIMESTAMP(webserver_daily.DAY) between=20 > > > > 1009839600 and 1041375600 )' AND webserver_daily.KID=3D3 > > > > apparently, Criteria does not implement clone(). > > if it cheers you up, you're not alone:=20 > >=20 > http://www.mail-archive.com/turbine-torque-user@jakarta.apache.org/msg > > 01 > > 480.html > > > > (probably you find something useful for you in this thread) > > > > i ended up working around this problem by creating a specific query=20 > > for Counts, either with Criteria (it should work if you=20 > just use the=20 > > Criteria one time), or with the village objects themself. > > > > rick > > > > > > - -- > > |- > > | peter riegersperger > > |- > > | ein windows switcher tagebuch:=20 > > |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----- > > > > > >=20 > --------------------------------------------------------------------- > > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org > > For additional commands, e-mail: torque-user-help@db.apache.org > > > > > > > >=20 > --------------------------------------------------------------------- > > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org > > For additional commands, e-mail: torque-user-help@db.apache.org > > >=20 >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org > For additional commands, e-mail: torque-user-help@db.apache.org >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org > For additional commands, e-mail: torque-user-help@db.apache.org >=20 >=20