I have Hibernate Second Level enabled and working with ehcache. Everything is fine and working well, except for the following relationship I have in one object. The relationship "graph" will not be retrieved from cache. I always see a DB query, even after cache has been primed. The really odd thing is that if I switch the fetch type to EAGER, then the caching starts working. I've carefully verified this a couple of times. Any thoughts? I don't see this documented anywhere as a limitation, so maybe a bug in hibernate? @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true) @JoinTable( name="cloud_provider_event_graph", joinColumns= {@JoinColumn(name="cloud_provider_event_id", referencedColumnName="id")} , inverseJoinColumns= {@JoinColumn(name="graph_id", referencedColumnName="id")} ) @Cache(region = "event_graph", usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) @IgnoreSizeOf private GraphAPIResult graph; Changing the first line to @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) makes the cache start working. |