You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Ludwig Magnusson <lu...@itcatapult.com> on 2010/05/03 16:19:21 UTC

Count using torque 3.1.1

Hi!

How can I create a SQL count statement using torque 3.1.1. Counthelper is
not available.

/Ludwig


RE: Count using torque 3.1.1

Posted by Greg Monroe <Gr...@dukece.com>.
D'oh.. should have paid more attention to version number...

You might be able to do this via a Criteria using addAsColumn
and the CUSTOM SqlEnum.  Then use BasePeer createQueryString and
executeQuery methods to get the results as a Village Record set.

A quicker "hack" might be to just create the SQL statement 
manually (e.g no Criteria) and call the executeQuery method.

Finally, if this is something done frequently, you might consider
creating a DB view that contains the summary information and then
create the Torque objects to access this view as a normal table.


> -----Original Message-----
> From: Ludwig Magnusson [mailto:ludwig@itcatapult.com]
> Sent: Monday, May 03, 2010 10:41 AM
> To: 'Apache Torque Users List'
> Subject: RE: Count using torque 3.1.1
> 
> Well, no it's not there and the reason I ask is because my customer is
> using
> torque 3.1.1 and an upgrade is out of my hands (and not an option here
> anyway).
> Was it impossible to do counts before CountHelper.
> /Ludwig
> 
> -----Original Message-----
> From: Greg Monroe [mailto:Greg.Monroe@dukece.com]
> Sent: den 3 maj 2010 16:36
> To: 'Apache Torque Users List'
> Subject: RE: Count using torque 3.1.1
> 
> I think CountHelper is in 3.1.1... but if you're looking for an
> alternative
> or it doesn't work, you might try getting the current head version and
> trying
> the new SummaryHelper class.  This didn't quite get into 3.1.1.. but was
> checked in after the release.
> 
> Here's some info on it:
> 
> http://mail-archives.apache.org/mod_mbox/db-torque-
> dev/200802.mbox/%3C8F5843
> B903F59D4C8C6806BB49A39119057D7A23@dukece-mail3.dukece.com%3E
> 
> 
> 
> > -----Original Message-----
> > From: Ludwig Magnusson [mailto:ludwig@itcatapult.com]
> > Sent: Monday, May 03, 2010 10:19 AM
> > To: 'Apache Torque Users List'
> > Subject: Count using torque 3.1.1
> >
> > Hi!
> >
> > How can I create a SQL count statement using torque 3.1.1. Counthelper
> is
> > not available.
> >
> > /Ludwig
> 
> DukeCE Privacy Statement:
> Please be advised that this e-mail and any files transmitted with
> it are confidential communication or may otherwise be privileged or
> confidential and are intended solely for the individual or entity
> to whom they are addressed. If you are not the intended recipient
> you may not rely on the contents of this email or any attachments,
> and we ask that you please not read, copy or retransmit this
> communication, but reply to the sender and destroy the email, its
> contents, and all copies thereof immediately. Any unauthorized
> dissemination, distribution or copying of this communication is
> strictly prohibited.
> 
> ---------------------------------------------------------------------
> 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


RE: Count using torque 3.1.1

Posted by Ludwig Magnusson <lu...@itcatapult.com>.
Well, no it's not there and the reason I ask is because my customer is using
torque 3.1.1 and an upgrade is out of my hands (and not an option here
anyway).
Was it impossible to do counts before CountHelper.
/Ludwig 

-----Original Message-----
From: Greg Monroe [mailto:Greg.Monroe@dukece.com] 
Sent: den 3 maj 2010 16:36
To: 'Apache Torque Users List'
Subject: RE: Count using torque 3.1.1

I think CountHelper is in 3.1.1... but if you're looking for an alternative
or it doesn't work, you might try getting the current head version and
trying
the new SummaryHelper class.  This didn't quite get into 3.1.1.. but was 
checked in after the release. 

Here's some info on it:

http://mail-archives.apache.org/mod_mbox/db-torque-dev/200802.mbox/%3C8F5843
B903F59D4C8C6806BB49A39119057D7A23@dukece-mail3.dukece.com%3E



> -----Original Message-----
> From: Ludwig Magnusson [mailto:ludwig@itcatapult.com]
> Sent: Monday, May 03, 2010 10:19 AM
> To: 'Apache Torque Users List'
> Subject: Count using torque 3.1.1
> 
> Hi!
> 
> How can I create a SQL count statement using torque 3.1.1. Counthelper is
> not available.
> 
> /Ludwig

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

---------------------------------------------------------------------
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


RE: Count using torque 3.1.1

Posted by Greg Monroe <Gr...@dukece.com>.
I think CountHelper is in 3.1.1... but if you're looking for an alternative
or it doesn't work, you might try getting the current head version and trying
the new SummaryHelper class.  This didn't quite get into 3.1.1.. but was 
checked in after the release. 

Here's some info on it:

http://mail-archives.apache.org/mod_mbox/db-torque-dev/200802.mbox/%3C8F5843B903F59D4C8C6806BB49A39119057D7A23@dukece-mail3.dukece.com%3E



> -----Original Message-----
> From: Ludwig Magnusson [mailto:ludwig@itcatapult.com]
> Sent: Monday, May 03, 2010 10:19 AM
> To: 'Apache Torque Users List'
> Subject: Count using torque 3.1.1
> 
> Hi!
> 
> How can I create a SQL count statement using torque 3.1.1. Counthelper is
> not available.
> 
> /Ludwig

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

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