Search code examples
javahibernatetimecriteriazk

JVM is taking too long to store the data into arraylist from criteria.list()


In my database I am having 11500 records. In DAO layer I am doing like this.

@Transactional
    public List<TrCaster> searchCasterList()  { 
        return getSessionFactory().getCurrentSession().createCriteria(TrCaster.class).list();
    }

It is working fine and When I am going to store it into another arraylist (say in service layer) It is taking too much time.

Can anybody suggest me the other approaches to store the data in an ArrayList. (As I am using ZK framework I need to maintain a list.)

Thanks in advance


Solution

  • Is there any List of object in your entity class which is defined as LAZY fetch? In case of LAZY fetch, while you are accessing the entity class, the list will be fetched from database and that might cause the slowness.