Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Weak caching problems with simple attributes


    I am having problems with Weak caching as specified by

<property name="eclipselink.cache.type.default" value="Weak" />

when it comes to simple properties of domain objects getting nulled out.

I load a domain object frequently, with caching, and it correctly fetches those objects from the cache without doing new queries. At some point, garbage collection kicks in, and while the domain objects don't get gc'ed, some of their properties do. So for instance a date field, or an enum field gets tossed. When I access these fields at a later time, i get NPEs because i'm expecting those fields to be there, but they are not. My test cases are completely read only, and for the first several minutes performing the actions works correctly, only after awhile does this behavior kick in. I believe it is the caching, as when i remove the cache type of 'Weak' from the configuration in persistence.xml, the problem goes away.

Any ideas?

Back to the top