| Modifier and Type | Optional Element and Description |
|---|---|
boolean |
enableBeanCache
Set this to false to disable the use of bean cache.
|
boolean |
enableQueryCache
Set this to true to enable the use of query cache.
|
String |
naturalKey
Specify the property that is a natural unique identifier for the bean.
|
boolean |
readOnly
When set to true the beans returned from a query will default to be
readOnly.
|
public abstract boolean enableQueryCache
By default query caching is disabled as the query cache invalidates frequently and so it is typically used for specific bean types and cases.
public abstract boolean enableBeanCache
By default bean caching is expected so this defaults to true. We might set this to false on a bean type that we want to use query caching but no bean caching (and this is expected to be a rare case).
When bean caching is enabled by default "find by id" and "find by unique natural key"
queries will try to use the bean cache. We use Query.setUseCache(boolean)
with false for the case when we do NOT want to use the bean cache.
public abstract String naturalKey
When a findUnique() query is used with this property as the sole expression then there will be a lookup into the L2 natural key cache.
public abstract boolean readOnly
If the bean is readOnly and has no relationships then it may be sharable.
If you try to modify a readOnly bean it will throw an IllegalStateException.
Copyright © 2016. All rights reserved.