I'm having the following problem. I have a survey which indicate the start / end of a given process. When I select the start date, everything works. When I put only the end date (and no other filter the search), here comes the problem.
I have a monster delay in the research and the session falls Ext. My bank has about 250,000 registered data to date. I did the following test:
Selected dates relating to the first cases registered and operated properly. Is there any way to improve this search?
Detail: I ran the query that generates the hibernate and research was done in 26seg.
Here's an excerpt from my method:
- DetachedCriteria criteria = DetachedCriteria.forClass(tipo);
- criteria.createAlias("sinistro", "sinistro");
- criteria.createAlias("responsavel", "responsavel");
I insert the data from the properties ... and
- try {
- setOrder(criteria);
- List retorno = null;
-
- DetachedCriteria rowCountCriteria = (DetachedCriteria)SerializationHelper.clone(criteria);
-
- int firstResult = 0;
- int maximumResults = 0;
-
- if (maxResults != null)
- maximumResults = maxResults;
-
- if (pageNumber != null)
- firstResult = (pageNumber * maxResults);
-
- criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
- retorno = getHibernateTemplate().findByCriteria(criteria, firstResult, maximumResults);
-
- rowCountCriteria.setProjection(Projections.rowCount());
- List results = getHibernateTemplate().findByCriteria(rowCountCriteria);
- if (results == null || results.isEmpty())
- rowCount = 0;
- else
- rowCount = results.get(0);
-
- return retorno;
-
- } catch (Exception e) {
- logger.error("Error:", e);
- throw new PersistenciaException();
- }
- }
Paging is being made. Frankly, I find no justification for the delay.
Thank you for your attention!