Thanks for the follow-up.
James Sutherland wrote:
Are you concerned with caching across transaction or within the same transaction?
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.
Does the @Cache NONE actually helps? I wasn't able to find out if the object was cached.
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.
Thanks for the tip.
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.
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.
Thanks
Jan