I am using JPA 2.0 with hibernate, and my cache provider is EHCache.
I am facing problem while caching a entity "A" which has one to many relationship with another entity "B" .
Whenever i fetch entity "A" through find by id call, it fetches the entity "A" from cache, but for the one to many association alone ,it fetches from database( i am able to the see a separate query being generated for fetching the entity "B" ) .
both the entities are annotated with @Cacheable.
can any of you please suggest me a way to cache the relationship in hibernate using jpa.
Thanks.
|