db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Monroe" <Greg.Mon...@DukeCE.com>
Subject RE: Query About Unions
Date Mon, 10 Apr 2006 13:23:44 GMT
You can use views with Torque's runtime but it can not create or
otherwise manage them with it's generator function.  I.e., generator
can create a runtime class for the view but none of the other
generator Ant tasks will work with them.

This is done by creating the view as a table in your XML schema with
the skipSql=true attribute set.  This class can be used like any other
Torque class to access the view (which is really a pseudo table to SQL
too). Note that using the "modify" function (e.g. insert, delete, etc)
a view may or may not work.  Torque will try to do it but you may get an
error from the SQL server.

As to Unions... Torque currently doesn't support these.  That's because 
there are a lot of issues around supporting these.  Some that come to 
mind are:  

AFAIK, there is a lot of variation in the way different SQL servers
support it (UNION DISTINCT is mentioned frequenty).  Torque strives
to be a relatively DB independent methodology. So doing this in a
DB independent way may be hard (at a minimum, a fair amount of research
into the variations/issues).  

Also, the results of a Union tends to be a subset of matching columns
from tables and not a full record.  Torque's data access objects are
table record driven, so there is no easy mapping from query to access
class here.

Of course, one way around the mapping problem is to use some of Torque's
native functions that just return a list. So, possibly we could add 
a Union method to the Criteria to support this.  But I think this will
hit a current design problem (that's slowly being worked on) around 
dealing with subqueries, e.g. col in ( select...).  This is because a 
Union is sort of like a specialized sub-query.

All that said, there is probably a way to use the CUSTOM modifier in
the criteria to sort of use Torque to do a mostly manually created
query with a UNION embedded in it.

Of course, others may know how to do this in a simple fashion... 
contribution of code or design strategy proving me wrong are always 

> -----Original Message-----
> From: Premcharan Maraka [mailto:Premcharan.Maraka@ascindia.com] 
> Hi,
>    Can we implement Unions, Views by Using Torque...Could 
> anybody guide me please?

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

View raw message