[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] descriptor.disableCacheHits() does not disable cache hits
|
disableHits will disable cache hits, so you should see two queries from two
different EntityManager always access the database. In fact your named
queries are not by primary key, so will always access the database. Perhaps
enable logging in EclipseLink to see the SQL access.
What you may be seeing is that two queries in the same EntityManager will
still get a cache hit. This is because the EntityManager represents a
persistence and transactional context, so the same object must always be
returned. To cause a refresh in the same EntityManager you must use
refresh() or the "eclipseLink.refresh" query hint.
Gaurav Malhotra wrote:
>
> I have positive result with the following usage
>
> @Entity
> @Cache (
> type=CacheType.WEAK,
> expiry=600000,
> alwaysRefresh =true,
> disableHits=false,
> coordinationType=CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES
> )
> @NamedQueries( {
> @NamedQuery(name = "CodFlexCodesB.findAll",
> query = "select o from CodFlexCodesB o"),
> @NamedQuery(name = "CodFlexCodesB.timeValidity",
> query = "SELECT em FROM CodFlexCodesB em " +
> "WHERE em.codFlexCodeSystemsB.id = :id AND " +
> "(em.startDate <= :endDate) AND (em.endDate >= :startDate OR
> em.endDate IS NULL) ",
> hints = @QueryHint(name=QueryHints.CACHE_USAGE,
> value=CacheUsage.ConformResultsInUnitOfWork )
>
> )
> })
>
>
> May be it helps.
>
>
> elygre wrote:
>>
>> While working with caching, I have customized a class descriptor, calling
>> "descriptor.disableCacheHits();". I figured that this would make multiple
>> calls to "em.find(key)" generate multiple SQL-statements to the database.
>>
>>
>>
>> This does not happen, and then I wonder why. There is really not much
>> else
>> going on, in terms of configuration and setup. Anything I need to switch
>> on?
>>
>>
>>
>> Eirik
>>
>
>
-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland
http://www.eclipse.org/eclipselink/
EclipseLink , http://www.oracle.com/technology/products/ias/toplink/
TopLink
Wiki: http://wiki.eclipse.org/EclipseLink EclipseLink ,
http://wiki.oracle.com/page/TopLink TopLink
Forums: http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink ,
http://www.nabble.com/EclipseLink-f26430.html EclipseLink
Book: http://en.wikibooks.org/wiki/Java_Persistence Java Persistence
--
View this message in context: http://www.nabble.com/descriptor.disableCacheHits%28%29-does-not-disable-cache-hits-tp18826932p18831764.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.