Reputation: 8693
What cache concurrency strategy should be used for @ManyToOne fields for a particular entity class. Would it make sense to use READ_ONLY instead of READ_WRITE, since these fields usually don't change after entity creation
@ManyToOne(fetch = FetchType.LAZY)
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
...
private User user;
Upvotes: 1
Views: 6554
Reputation: 1554
If these fields "usually don't change" as opposed to "never change", then READ_ONLY is not an option. The other cache concurrency strategies offer different tradeoffs between database throughput and transaction integrity. The choice would depend on your particular circumstances and requirements.
Upvotes: 3