cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tomi NA" <hef...@gmail.com>
Subject a...bug with pgsql and addPrefetch? (Cay 1.2B2)
Date Thu, 11 May 2006 15:14:27 GMT
I have a table with 50-100 thousand records which I want to search on
a find-as-you-type basis.
This is what was executed when a key was pressed:

        results = new ArrayList();
        List<MyRec> myRecs = null;

        String[] searchKeys = dissassemble(pattern);
        SelectQuery query = prepQuery(searchKeys);
        query.addPrefetch(MyRec.TO_OTHER_REC_PROPERTY);
        query.setFetchLimit(100);
        myRecs = myContext.performQuery(query);
        for (MyRec mr : myRecs) {
            results.add(mr.getToOtherRec());
        }

Now, what happens is that 2 queries are run. The first is limited to
100, just the way I wanted it. The second, however, is not: it will
return 50k records no questions asked.

I can work arround the problem just by not doing the prefetch: then
everything works i.e. my app doesn't break down due to an
OutOfMemoryException.
If I missunderstood the intended behaviour of addPrefetch, someone
please correct me. Otherwise, I'll proceed to submiting a bug
report...

Tomislav

Mime
View raw message