Topic
No replies
MandarChatufale
MandarChatufale
18 Posts
ACCEPTED ANSWER

Pinned topic QueryCache with L2 Cache with Hibernate

‏2013-08-20T12:21:57Z |

Hi,

I am trying to use wxs as L2 cache for hibernate. I want to use query cache.Below are steps i followed

Created a backing map in objectgrid.xml as "query.Customer and  added its entry in deployment.xml

  1.       <backingMap name="query.Customer" readOnly="false" copyKey="false"                  lockStrategy="PESSIMISTIC" copyMode="COPY_TO_BYTES" />

 Added the region names in jpa properties -

<prop key="objectgrid.hibernate.regionNames">query.Customer</prop>

Set the query cache value to true -

<prop key="hibernate.cache.use_query_cache">true</prop>

Questions.

1 - Do we need to set

query.setHint("org.hibernate.cacheable",true);

query.setHint("org.hibernate.cacheRegion","query.Customer");

2 - Do we need to set "backingMapPluginCollections" in objectgrid.xml? Is this step compulsory?

 

 

Whenever i set query.setHint(), an exception is thrown

org.springframework.orm.hibernate3.HibernateSystemException: Can't get sql: select customer0_.CUSTOMER_NUMBER as CUSTOMER1_4_,

Caused by: com.ibm.websphere.objectgrid.ObjectGridRuntimeException: com.ibm.websphere.objectgrid.plugins.LoaderException: java.lang.NullPointerException

at com.ibm.ws.objectgrid.hibernate.cache.HibernateObjectGridResourceFactory.executeObjectMap(HibernateObjectGridResourceFactory.java:1345) ~[wxshibernate.jar:WXSDEV.XS [a1246.15174705]]

at com.ibm.ws.objectgrid.hibernate.cache.ObjectGridHibernateCache.get(ObjectGridHibernateCache.java:353) ~[wxshibernate.jar:WXSDEV.XS [a1246.15174705]]

... 132 common frames omitted

Caused by: com.ibm.websphere.objectgrid.plugins.LoaderException: java.lang.NullPointerException

at com.ibm.ws.objectgrid.map.BaseMap.getRaw(BaseMap.java:4593) ~[wsobjectgrid.jar:WXSDEV.XS [a1246.15174705]]

at com.ibm.ws.objectgrid.DiffMap.lookForKeyReturnStatus(DiffMap.java:1353) ~[wsobjectgrid.jar:WXSDEV.XS [a1246.15174705]]

at com.ibm.ws.objectgrid.DiffMap.lookForKey(DiffMap.java:1142) ~[wsobjectgrid.jar:WXSDEV.XS [a1246.15174705]]

at com.ibm.ws.objectgrid.DiffMap.get(DiffMap.java:955) ~[wsobjectgrid.jar:WXSDEV.XS [a1246.15174705]]

at com.ibm.ws.objectgrid.ObjectMapImpl.get(ObjectMapImpl.java:446) ~[wsobjectgrid.jar:WXSDEV.XS [a1246.15174705]]

at com.ibm.ws.objectgrid.ObjectMapImpl.get(ObjectMapImpl.java:406) ~[wsobjectgrid.jar:WXSDEV.XS [a1246.15174705]]

at com.ibm.ws.objectgrid.jpa.cache.common.CommonObjectGridResource.get(CommonObjectGridResource.java:268) ~[wsobjectgrid.jar:WXSDEV.XS [a1246.15174705]]

at com.ibm.ws.objectgrid.hibernate.cache.HibernateObjectGridResourceFactory.processObjectMapOperation(HibernateObjectGridResourceFactory.java:1392) ~[wxshibernate.jar:WXSDEV.XS [a1246.15174705]]

at com.ibm.ws.objectgrid.hibernate.cache.HibernateObjectGridResourceFactory.executeObjectMap(HibernateObjectGridResourceFactory.java:1320) ~[wxshibernate.jar:WXSDEV.XS [a1246.15174705]]

... 133 common frames omitted

Caused by: java.lang.NullPointerException: null

at com.ibm.ws.objectgrid.xdf.QueryContext.getPositionOfObject(QueryContext.java:142) ~[wsobjectgrid.jar:WXSDEV.XS [a1246.15174705]]

at com.ibm.ws.objectgrid.xdf.serializers.XDFFieldSerializer.processReferenceForHashCode(XDFFieldSerializer.java:130) ~[wsobjectgrid.jar:WXSDEV.XS [a1246.15174705]]

at com.ibm.ws.objectgrid.xdf.serializers.GenericClassSerializer.hashCode(GenericClassSerializer.java:557) ~[wsobjectgrid.jar:WXSDEV.XS [a1246.15174705]]

at com.ibm.ws.objectgrid.xdf.serializers.GenericClassSerializer.hashCode(GenericClassSerializer.java:614) ~[wsobjectgrid.jar:WXSDEV.XS [a1246.15174705]]

at com.ibm.ws.objectgrid.xdf.XDFKeySerializerPlugin.getPartitionHashCode(XDFKeySerializerPlugin.java:137) ~[wsobjectgrid.jar:WXSDEV.XS [a1246.15174705]]

at com.ibm.ws.objectgrid.xdf.XDFKeySerializerPlugin.getPartitionHashCodeFromObject(XDFKeySerializerPlugin.java:257) ~[wsobjectgrid.jar:WXSDEV.XS [a1246.15174705]]

at com.ibm.ws.objectgrid.PartitionManagerImpl.getPartition(PartitionManagerImpl.java:271) ~[wsobjectgrid.jar:WXSDEV.XS [a1246.15174705]]

at com.ibm.ws.objectgrid.client.RemoteCacheLoader.get(RemoteCacheLoader.java:294) ~[wsobjectgrid.jar:WXSDEV.XS [a1246.15174705]]

at com.ibm.ws.objectgrid.map.BaseMap.getRaw(BaseMap.java:4579) ~[wsobjectgrid.jar:WXSDEV.XS [a1246.15174705]]