Hi Diego,
> (SqlSelectQuery is deprecated)
For a reason. SQLTemplate is incomparably more powerful. Once you learn
how to use it, you will never want to go back.
> In general, my problem is, How i can perform a generic query in the
> DataContext (SqlSelectQuery is deprecated) without any ObjEntity and
> DbEntity
If you select "data rows" with SQLTemplate (i.e. Map objects that do
not have ObjEntities), rootClass parameter to SQLTemplate constructor
is simply used to find the correct DataNode. So it can be ANY class
from your DataMap - the result doesn't have to map to this class. E.g.:
SQLTemplate query = new SQLTemplate(Vtvh010Clientes.class, sql, true);
query.setFetchingDataRows(true);
List rows = context.performQuery(query);
> try{
> data = ctxt.performQuery(query);
> }catch(org.objectstyle.cayenne.CayenneRuntimeException e){
> but don't return any rows, why???
Can be two reasons:
1. Query didn't match any data.
2. Your exception handling is incorrect. What I mean is that if you
catch an exception and quietly proceed ignoring it, you can't tell what
really happened. At least print a stack trace before making any
assumptions about the outcome.
Hope this helps.
Andrus
On Apr 25, 2005, at 2:13 PM, Diego Maximiliano Iñigo wrote:
> I use the new cayenne 1.2M3, and I need run this query:
>
> SELECT * FROM DBAORA.TT10COTIZACION, DBAORA.TT20MODELO
> WHERE TT10NROCOT = 1
> AND TT10NROCOT = TT20NROCOT
>
> DataContext ctxt =
> BasicServletConfiguration.getDefaultContext(request.getSession());
> String sql = "SELECT * FROM DBAORA.TT10COTIZACION, DBAORA.TT20MODELO
> " +
> " WHERE TT10NROCOT = 1 AND TT10NROCOT = TT20NROCOT";
> SQLTemplate query = new SQLTemplate(Vtvh010Clientes.class,sql,true);
> List data = null;
> try{
> data = ctxt.performQuery(query);
> }catch(org.objectstyle.cayenne.CayenneRuntimeException e){
> but don't return any rows, why???
> the Vtvh010Clientes.class not corresponding with 2 tables for this
> query DBAORA.TT10COTIZACION, DBAORA.TT20MODELO, it is the problem???
> how to resolve this problem, beucase i need all colunm the query.
>
> In general, my problem is, How i can perform a generic query in the
> DataContext (SqlSelectQuery is deprecated) without any ObjEntity and
> DbEntity
>
> Any help would be much apreciatted. Thanks
> Diego
This archive was generated by hypermail 2.0.0 : Mon Apr 25 2005 - 22:00:38 EDT