Hi Andreas,
I am not sure I understand exactly what is happening in your
case. Please provide some more details.
As for the logging, there is no specific cache retrieval log
message, but you can infer cache retreival from a combination. Here
is an example where we get an object from the cache:
[EL Finest]: query: 2013-09-23
10:28:29.246--UnitOfWork(10270267)--Thread(Thread[main,5,main])--Execute
query ReadObjectQuery(name="readObject" referenceClass=Technology
sql="SELECT ID FROM TECHNOLOGY WHERE (ID = ?)")
[EL Finest]: transaction: 2013-09-23
10:28:29.246--UnitOfWork(10270267)--Thread(Thread[main,5,main])--Register
the existing object foo.Technology@16077c2
Note, we log "execute query", but not actual execution on the
Connection.
Here is the same query run without the cache hit:
[EL Finest]: query: 2013-09-23
10:30:48.645--UnitOfWork(20356474)--Thread(Thread[main,5,main])--Execute
query ReadAllQuery(name="indexes" referenceClass=Index )
[EL Finest]: connection: 2013-09-23
10:30:48.646--ServerSession(18543353)--Connection(5232795)--Thread(Thread[main,5,main])--Connection
acquired from connection pool [default].
[EL Fine]: sql: 2013-09-23
10:30:48.646--ServerSession(18543353)--Connection(5232795)--Thread(Thread[main,5,main])--SELECT
ID, TECHNOLOGY_ID FROM INDEX1 WHERE (TECHNOLOGY_ID = ?)
bind => [2]
[EL Finest]: connection: 2013-09-23
10:30:48.662--ServerSession(18543353)--Connection(5232795)--Thread(Thread[main,5,main])--Connection
released to connection pool [default].
Note the logging on the connection.
-Tom
On 21/09/2013 8:15 PM, Andreas Joseph
Krogh wrote:
Hi.
It still seems to me that caching in EL doesn't behave as
expected.
This is what I observe:
Having these properties set:
<prop
key="eclipselink.cache.shared.default">false</prop>
<prop
key="javax.persistence.sharedCache.mode">ENABLE_SELECTIVE</prop>
results in *nothing* being cached
Having only
<prop
key="javax.persistence.sharedCache.mode">ENABLE_SELECTIVE</prop>
results in too much being cached, and oddly enough some
entities which should be cached not being cached. That is
Person with ID=1 is cached but with ID=2 is not cached.
By too much I mean entities which are not @Cacheable are
still being cached. Specifically, an entity not annotated with
@Cacheable is loaded from DB but some of its (non-cascaded)
associations (@OneToMany) are not refreshed. This works
correctly when turning off all caching with
eclipselink.cache.shared.default=false.
Is there any logging I can turn on to see when EL fetches
an entity (or collection) from cache?
Thanks.
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
|