Different cache concurrent strategies for root entity and its collection (Hibernate with EHCache)?
- by grigory
Given example from Hibernate docs and modifying it so that root level entity (Customer) is read-only while one of its collections (tickets) is read-write:
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
public class Customer {
...
@OneToMany(...)
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public SortedSet<Ticket> getTickets() {
return tickets;
}
...
}
Would collection of tickets get refreshed when accessing customer from cache?