« Return to Thread: Inserts and Caching
ossaert wrote:Thanks for the follow-up.It is the caching within the same transaction. Let's say in one transaction I have to persist 5000 objects which I do not need afterwards. They should not unnecessary remain in memory. When a couple of requests are running, then the memory is filled up pretty quickly.James Sutherland wrote:Are you concerned with caching across transaction or within the same transaction?
Does the @Cache NONE actually helps? I wasn't able to find out if the object was cached.Thanks for the tip.James Sutherland wrote:Across transaction you can disable caching using the persistence.xml property,
"eclipselink.cache.shared.default"="false". Or you can set the size or type of the cache to control how many objects are cached.Ok, but then the transaction is committed and restarted. In case of a rollback I have "unstable" data since the part before the flush wasn't rolled back.James Sutherland wrote:For avoiding caching within a single transaction, the best way is to flush() then clear() the EntityManager. You could do this for each object, or probably better for each batch of objects.
Thanks
Jan
« Return to Thread: Inserts and Caching
| Free embeddable forum powered by Nabble | Forum Help |