首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

试工Hibernate二级缓存Ehcache

2012-10-30 
试用Hibernate二级缓存Ehcache? Hibernatesupports several third-party caching services.?After some re

试用Hibernate二级缓存Ehcache

? Hibernatesupports several third-party caching services.?After some research, the team has concluded that Ehcache would besuitable for our requirements, namely the caching of frequently-accessed,read-only tables.

?

Ehcache Evaluation

?

Hibernate 3.3.2 GA

  • Ehcache 1.2.3 (an optional JAR bundled with Hibernate 3.3.2)
  • Hibernate Annotations 3.4.0 GA


    Configuration

    Hibernate is configured to enable caching.

  • An ehcache.xml file is created and placed on the classpath.
  • Model classes are updated to add @Cache annotations to entities and associations.
  • Hibernate Query instances are explicitly designated as cacheable before execution.

    ?

    ?3,model example,Questionnaire.java

    ?4,Query cache,??? Old:
    Depth Optimization??? Old:
    private List<Response> findRespose(Long pageInQuestionId, Set aSetResponses,String responseValue) {List<Response> lResponses = new ArrayList();Iterator listResponses = aSetResponses.iterator();while (listResponses.hasNext()) {Response lResponse = (Response) listResponses.next();if (lResponse.getQuestion().getId() == pageInQuestionId && lResponse.getValue().equals(responseValue)){lResponses.add(lResponse);} } // Response could not be found:return lResponses;}
    ??If any question I will put in this thread.

  • 热点排行