seba.wagner
seba.wagner

Reputation: 3860

prevent single tables from using the cache

We are using OpenJPA 2.2.x and have a couple of tables that are filled outside our application (by an Asterisk plugin).

This forces us to disable OpenJPA caching in general. That might have a bad effect and actually caching can be quite handy for performance and tuning later. After all I think it is also a rather bad design decision to disable the caching completely just because of a single feature.

Is there a way to force OpenJPA to always read certain tables from the database instead of using the cache?

Or are there other popular patterns to resolve this?

Thanks!
Sebastian

Upvotes: 3

Views: 62

Answers (1)

Rick
Rick

Reputation: 3840

Take a look at the JPA 2.0 spec.... it should outline exactly what you're looking for.

The short story is that you could set <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode> in your p.xml and use the @javax.persistence.Cachable annotation in cacheable Entities.

Hope this helps.

Rick

Upvotes: 4

Related Questions