Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Query returning stale results existing

Don't forget this bug when working with @Cache settings:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=231843

To Quote Shawn:

"If you define a "default" cache type in
persistence.xml then this is not treated like a default but rather as a global
override and any cache type setting in either annotations or mapping files are
ignored thus rendering it impossible to configure caches on an Entity by Entity
basis."

./tch



On Thu, Nov 20, 2008 at 9:21 AM, James Sutherland <jamesssss@xxxxxxxxx> wrote:
>
> You can set cache setting per class in the EclipseLink orm XML file.  This
> file can be used to supplement annotations or the JPA orm XML file, and will
> be ignored by other JPA implementations, so is a portable way.  You can also
> use the @Cache annotation, which is still portable as it will be ignored by
> other JPA implementation, but does require a compile dependency.
>
> persistence.xml properties can only do so much, more advanced settings need
> a real XML file.
>
>
>
> cowwoc wrote:
>>
>>
>> James Sutherland wrote:
>>>
>>> EntityManager.refresh() is the only way in the JPA spec to ensure an
>>> object is refreshed.  If you use optimistic locking or the the read
>>> lock() API you can guarantee that the transaction will fail if the object
>>> is out of date.
>>>
>>> EclipseLink also defines a Query hint "eclipselink.refresh" to allow a
>>> query to force a refresh.  The are also may different caching options,
>>> such as invalidation, auto-refreshing, isolation, and cache coordination.
>>>
>>
>> EntityManager.refresh() worked :)
>>
>> PS: It would be nice if cache expiration settings were available at the
>> persistence.xml level. Ideally I want to isolate all EclipseLink-specific
>> features to that file and keep my classes portable across all JPA
>> implementations.
>>
>> Thank you,
>> Gili
>>
>
>
> -----
> ---
> 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/Query-returning-stale-results-existing-tp20559804p20602036.html
> Sent from the EclipseLink - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>


Back to the top