I would like to annotate many of my Hibernate objects that contain reference data and / or configuration data using
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
However, my JUnit tests set up and tear off some of this link / configuration data using Hibernate objects. Is there a recommended way for entities to be read and written during test installation and deletion, but read-only for production code?
Two of my immediate thoughts for imperfect workarounds:
- Using NONSTRICT_READ_WRITE, but I'm not sure what the hidden cons are.
- Subclassing in my test code to override read-only cache annotations.
Any recommendations on the cleanest ways to handle this?
(Note: Project uses maven.)
Rick source
share