eclipselink.query-results-cache.ignore-null not caching any result

雨燕双飞 提交于 2019-12-11 12:40:05

问题


I am using EclipseLink 2.5.0 I am trying to achieve following.

  • Query an object using non-key filters.
  • If result is not null, it should be cached, and future queries with same filter values should not go to data base.
  • If no result is found, the result should not be cached and future queries with same filter values should go to data base.

I think, I should be able to achieve it with eclipselink.query-results-cache.ignore-null hint, but if I include following

<hint name="eclipselink.query-results-cache.ignore-null" value="true"/>

No result is being cached. And if I am including following

<hint name="eclipselink.query-results-cache" value="true"/>

Even 'none'(no record found) is being cached. My complete named query looks like following

 <named-query name="find.Employee.findEmployeeByPlace">
        <description>
        Find employee by place.
        </description>
        <query><![CDATA[
        select e 
        from Employee e
        where e.place = :place
        ]]></query>
        <!--<hint name="eclipselink.query-results-cache" value="true"/>-->
        <hint name="eclipselink.query-results-cache.ignore-null" value="true"/>
    </named-query>

My findings seems to be opposite of How to get Glassfish/EclipseLink/JPA to cache entityManager.find results that return null

来源:https://stackoverflow.com/questions/17465692/eclipselink-query-results-cache-ignore-null-not-caching-any-result

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!