Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » @cache (size limitations in Eclipselink 2.4.2, JPA 2.0 )
@cache [message #1697291] Tue, 02 June 2015 23:17 Go to next message
Sunny Ravi is currently offline Sunny RaviFriend
Messages: 2
Registered: June 2015
Junior Member
Greetings,
My entities are mapped to oracle 12c database. The client needs to check for objects in the incoming stream with the existing ones in the DB. I am doing a getDestDim.Findall() to get the list of result set from DestDim table in the DB.

How can I use cache here and to pre-fetch the result and just query the cache.
Going though the doc, I noticed that @cache has a size property. If I set the size to say 64000.

1.Is this size from the documentation mentioning in bytes ? is it 6.4 MB or 64 MB ?

2. What happens if the records in the db column are more then the size ?
Does the cache grow automatically.

3.When does the cache hit the ceiling and what will happen then ? does fetching of new records fail ? How will the client be notified that the cache is full in all the useless above .

Appreciate your input.

Thanks
Sunny
Re: @cache [message #1697382 is a reply to message #1697291] Wed, 03 June 2015 14:03 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
A cache works by holding a reference to your entities so that they can be accessed again without hitting the database. When it is full, it just means that reading an object that isn't in the cache causes it to be built and placed in the cache - so the least recently accessed one gets pushed out. No warnings or problems should occur, except if you constantly read 10001 records sequentially each time, but have a cache of 10000 it might negate the value of a cache.

Size - the cache deals with your java objects, not their size. Depending on the cache you are referring, 64000 would be the number of references that would be held. There are different caches with different behaviors and different reference types. I assume you have seen https://wiki.eclipse.org/EclipseLink/Examples/JPA/Caching but you should look at http://www.eclipse.org/eclipselink/documentation/2.6/concepts/cache.htm and http://www.eclipse.org/eclipselink/documentation/2.6/solutions/performance001.htm#CHDCGIHF to answer your questions.
Re: @cache [message #1697420 is a reply to message #1697382] Wed, 03 June 2015 18:40 Go to previous messageGo to next message
Sunny Ravi is currently offline Sunny RaviFriend
Messages: 2
Registered: June 2015
Junior Member
Thank you Chris for the reply and the info on the cache. What are the different strategies available to avoid Out of memory errors . I came across

1. pagination
2. Use Coherence cache

In addition I am looking at JPQL to fetch only the required db columns instead of the whole table (with the current impl). Any specific examples on jpql would be helpful

-Sunny
Re: @cache [message #1697658 is a reply to message #1697420] Fri, 05 June 2015 18:40 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
There are a number of options listed at https://wiki.eclipse.org/EclipseLink/Performance and http://www.eclipse.org/eclipselink/documentation/2.5/solutions/performance002.htm that might help, such as the pagination you've mentioned and even read-only queries (since the entities returned don't have to be cloned, it reduces the memory required). Using JPQL to return selected attributes though is handling/returning raw data, so your query may avoid the memory costs of dealing with a full entity, but then you lose the benefits of caching etc. You are getting into tradeoffs that really require understanding your applications design and usage that are hard to understand through a forum.

There are a few simple JPQL examples here: https://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Querying/JPQL#Select_query_examples

Previous Topic:Exception when read Geometry type from Postgis
Next Topic:eclipselink:session.validate
Goto Forum:
  


Current Time: Fri Oct 11 14:51:25 GMT 2024

Powered by FUDForum. Page generated in 0.03951 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top