Different cache concurrent strategies for root entity and its collection (Hibernate with EHCache)?

Posted by grigory on Stack Overflow See other posts from Stack Overflow or by grigory
Published on 2010-04-30T03:37:41Z Indexed on 2010/04/30 4:17 UTC
Read the original article Hit count: 256

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?

© Stack Overflow or respective owner

Related posts about hibernate

Related posts about collection