persistence@glassfish.java.net

Re: Disable TopLink caching

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Mon, 28 Aug 2006 18:54:07 -0700

Tom,

The question is (I think - Markus is on vacation this week) whether
it's possible to disable caching between transactions, so that the
users see the world exactly as the database does. Otherwise the user
will need to have a try-catch block around each refresh - not an EOU
case. :(.

thanks,
-marina

Tom Ware wrote On 08/24/06 07:20,:
> 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.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>