Hello,

I have to do some complex queries to data base and to do that on I'm writing them in SQL.

It works great with SQLSelect but when I need to prefetch something ( to avoid hundreds of queries when showing data in a tableView) it does not work,

from javaDoc it seems that prefetching with SQLSelect is possible but I have not found any info or example.

for example if i do:

       SelectQuery<Servico> query = new SelectQuery<>(Servico.class);

        query.addPrefetch("table1");
        query.addPrefetch("table3");
        query.addPrefetch("table4");

        getContext().performQuery(query);

cayenne makes 4 queries and all data is displayed on table.

but if I run:

   SQLSelect<Servico> query = new SQLSelect<>(Servico.class, "select * from servico;");

        query.addPrefetch("table1", PrefetchTreeNode.UNDEFINED_SEMANTICS);
        query.addPrefetch("table3", PrefetchTreeNode.UNDEFINED_SEMANTICS);
        query.addPrefetch("table4", PrefetchTreeNode.UNDEFINED_SEMANTICS);

        getContext().performQuery(query);

it makes hundreds of queries when trying to show data on table (like if no prefetch was made), I've tried to make a join but does not work either.


Reply via email to