I believe I've found the culprit.
The following bit of code in BeanDescriptor.java struct me as dangerous since it doesn't make any checks to see if the bean cache was enabled explicitly:
private ServerCache getBeanCache() { if (beanCache == null) { beanCache = cacheManager.getBeanCache(beanType); } return beanCache; }
So i set about trying to trigger it. What I found is that if you get a reference to an entity via Ebean.getReference(Entity.class, id) then later access a field of that entity it triggers a lazy load pathway that calls getBeanCache() creating the cache and causing it to be used for that entity from there on out.
The stack trace looks like this when calling entity.getSomeField() and breaking in getBeanCache() :
at com.avaje.ebeaninternal.server.deploy.BeanDescriptor.getBeanCache(BeanDescriptor.java:1016) at com.avaje.ebeaninternal.server.deploy.BeanDescriptor.loadFromCache(BeanDescriptor.java:1221) at com.avaje.ebeaninternal.server.core.DefaultBeanLoader.refreshBeanInternal(DefaultBeanLoader.java:430) at com.avaje.ebeaninternal.server.core.DefaultBeanLoader.loadBean(DefaultBeanLoader.java:401) at com.avaje.ebeaninternal.server.core.DefaultServer.loadBean(DefaultServer.java:517) at com.avaje.ebean.bean.EntityBeanIntercept.loadBeanInternal(EntityBeanIntercept.java:531) at com.avaje.ebean.bean.EntityBeanIntercept.loadBean(EntityBeanIntercept.java:491) at com.avaje.ebean.bean.EntityBeanIntercept.preGetter(EntityBeanIntercept.java:623)
Cheers,
Mark
Fixed in HEAD.