I have three Entity Class MyEntity1,MyEntity2,MyEntity3. Each of this classes are marked with
@Cacheable(true).
Following Structure of MyEntity1 is as below
class MyEntity1{
@OneToMany(fetch=FetchType.Lazy, mappedBy = "myEntity1")
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
private Set<MyEntity2> myEntities2;
@OneToOne(fetch=FetchType.Lazy,mappedBy="myEntity1",cascade=CascadeType.All)
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
private MyEntity3 myEntity3;
}
Now the problem is MyEntity2 is getting cached properly but MyEntity3 is not getting cached inspiteof being Marked with @Cacheable(true).
Definition of MyEntity3 is as below
@Entity
@Cacheable(true)
@NamedQueries({
@NamedQuery(name="myQuery",query="...",@QueryHint(name = "org.hibernate.cacheable", value = "true"))
})
Class MyEntity3{
//instance fields
}
I am not able to figure out why MyEntity3 is not getting cached while other entities are getting cached?
Can anyone help in this?