2
I am changing the code of a query, because it will return many data when the database is well populated. I’m paging the query. The problem is that when they implemented it, they did it this way:
Takes a string, and all possible combinations are made with it, for example the phrase: "test 2 test 3 test 4", generates about 15 strings and it performs 15 selects. A query I know how to paginate, using
query.setFirstResult(inicioPagina);
query.setMaxResults(tamanhoDaPagina);
the problem arises when there are several queries.
------------------Solution------------------------------------------- I was able to solve the Aki :D problem
then the problem arose when I made the registration of more than 50mb in the database, and began to give some problems of memory on the server, the solution I created was to restore the Whole Object queries, return only the ID, and at the end I select only the page IDS and consult only the page
Why does Voce make 15 selects? Can’t be a select, with 15 conditions in Where?
– jpkrohling
So the problem that selects are strings with the condition Like "%string%". I tried to query and by what I studied , is not possible seems
– Paulo
I don’t know which database you’re using, but it’s perfectly possible to do "and (field like '%string%' or field like '%string2%')", although I think a query like this would cause performance problems. In these cases, it is best to use some "full text" search solution such as Apache Lucene.
– jpkrohling