I have enabled EhCache for my level 2 cache and confirmed it is able to retrieve cached entities for the simplest use case where an entity has no other entity relationships; however, when I try to cache an entity that contains a @OneToOne relationship using a mappedBy association, the generated SQL appears to be creating a join onto the the related entity and failing to load entities from the cache. I have confirmed the entities are coming from the DB based on both performance and generated SQL.
Any help on this would be much appreciated.
@Entity @Cacheable @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public class ParentObject extends Object {
@OneToOne(targetEntity=ChildObject.class,mappedBy="parentObject", fetch=FetchType.LAZY) @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) private ChildObject child;
|