persistence@glassfish.java.net

Re: Disable TopLink caching

From: Tom Ware <tom.ware_at_oracle.com>
Date: Thu, 24 Aug 2006 10:20:08 -0400

There is a bunch of information on extend persistence context and
transaction scoped persistence context in section 5.6 of the
specification. I believe extended persistence context is the default.

In a transactional persistence context, the ServerSession cache
implements any caching used between transactions.

In an extended persistence context, the RepeatableWriteUnitOfWork is
used. As a result, in an extended persistence context, you must use the
UnitOfWork's built-in caching which by design uses FullIdentityMap in
order to ensure object identity is maintained throughout its use.

-Tom

Markus Fuchs wrote:

>Hi Tom,
>
>How can a non-extended persistence context be specified in JPA? I
>understand your answer that toplink.cache.type.default can be used to
>achieve this goal as it applies to the ServerSession cache, which
>implements the caching btw. transactions functionality, correct?
>
>Thanks,
>
>-- markus.
>
>Tom Ware wrote:
>
>
>
>>Hi Markus,
>>
>> In JPA, when using an extended persistence context we will cache
>>between transactions.
>>
>> The toplink.cache.type.default property affects the caching of the
>>TopLink ServerSession that underlies the EntityManagerFactory.
>>EntityManager's using an extended persistence context will be based on
>>a TopLink UnitOfWork which, in order to maintain object identity, has
>>a more complete cache.
>>
>>-Tom
>>
>>Markus Fuchs wrote:
>>
>>
>>
>>>Hi Tom,
>>>
>>>Is it possible to disable TopLink's between transactions cache by
>>>setting
>>>
>>><property name="toplink.cache.type.default" value="NONE"/>
>>>
>>>in persistence.xml?
>>>
>>>Thanks,
>>>
>>>-- markus.
>>>
>>>
>>>
>>>
>>>
>>>