views:

19

answers:

0

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:

  1. DetachedCriteria criteria = DetachedCriteria.forClass(tipo);
  2. criteria.createAlias("sinistro", "sinistro");
  3. criteria.createAlias("responsavel", "responsavel");

I insert the data from the properties ... and

  1. try {
  2. setOrder(criteria);
  3. List retorno = null;
    1. DetachedCriteria rowCountCriteria = (DetachedCriteria)SerializationHelper.clone(criteria);
    1. int firstResult = 0;
  4. int maximumResults = 0;
    1. if (maxResults != null)
    2. maximumResults = maxResults;
      1. if (pageNumber != null)
    3. firstResult = (pageNumber * maxResults);
      1. criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    4. retorno = getHibernateTemplate().findByCriteria(criteria, firstResult, maximumResults);
      1. rowCountCriteria.setProjection(Projections.rowCount());
    5. List results = getHibernateTemplate().findByCriteria(rowCountCriteria);
    6. if (results == null || results.isEmpty())
    7. rowCount = 0;
    8. else
    9. rowCount = results.get(0);
      1. return retorno;
      1. } catch (Exception e) {
    10. logger.error("Error:", e);
    11. throw new PersistenciaException();
    12. }
    13. }

Paging is being made. Frankly, I find no justification for the delay.

Thank you for your attention!