Hi All,
I'm working on a POC which is ment to benchmark different L2 cache options for Hibernate. For that we created a simple spring application which uses only a table. This particular table holds around 5000 rows (four columns, id as primary key). But when we fire an HQL (sessionFactory.getCurrentSession().createQuery("from Contact");)from our DAO, it takes around 38 -42 seconds to return the results, which is an unacceptable behavior. Please have a look at our code
Code:
                
                  //long start = System.currentTimeMillis();
      Query query =  sessionFactory.getCurrentSession().createQuery("from Contact");
      query.setReadOnly(true);
      query.setCacheable(true);
      long start = System.currentTimeMillis();
      List<Contact> conList =query.list();
      /* HazeleCastUtil.putIntoHazelcast(conList);*/
      long elapsedTimeMillis = System.currentTimeMillis()-start;
      // Get elapsed time in seconds
      float elapsedTimeSec = elapsedTimeMillis/1000F;
      System.out.println("============================== >>>>> " +elapsedTimeSec);
Code:
<hibernate-configuration>
   <session-factory>
      
      <!--
      For Hazle Cast-->
      
      <property name="hibernate.show_sql">true</property>
      <property name="hibernate.cache.use_second_level_cache">true</property>
      <property name="hibernate.cache.use_query_cache">true</property>
      <property name="hibernate.cache.use_minimal_puts">true</property>
      <property name="hibernate.cache.provider_class">com.hazelcast.hibernate.provider.HazelcastCacheProvider</property>
    </session-factory>
</hibernate-configuration>
Looking forward for help :)
Thanks and regards,
Sankallada