-
Book Overview & Buying
-
Table Of Contents
WildFly Configuration, Deployment, and Administration - Second Edition - Second Edition
The query cache can be used to cache the result set of a query. This means that if the same query is issued again, it will not hit the database but return the cached value.
The query cache does not cache the state of the actual entities in the result set; it caches only the identifier values and results of the value type.
In the following example, the query result set named listUsers is configured to be cached using the @QueryHint annotation inside a @NamedQuery annotation:
@NamedQueries(
{
@NamedQuery(
name = "listUsers",
query = "FROM User c WHERE c.name = :name",
hints = { @QueryHint(name = "org.hibernate.cacheable", value =
"true") }
)
})
public class User {
@Id
@Column(name="key")
private String key;
@Column(name="name")
private String name;
...
}Overuse of the query cache may reduce your application's performance, so use it wisely. First, the query cache will increase the memory requirements if your queries (stored as key in the query cache map) are made up...
Change the font size
Change margin width
Change background colour