Each entity type or collection is understood to
store its state in one or more query spaces. Usually, the query spaces are automatically
determined by the mapping, but sometimes they must be specified explicitly using
@Synchronize.
Query spaces mediate the interaction between query execution and synchronization of in-memory state with the database:
Typically, query spaces are independent (non-overlapping), and Hibernate always treats them as such. Overlapping or hierarchical query spaces are in principle meaningful, but any such relationship between query spaces is the responsibility of the client.
A query space name is not always a table name. In principle, it's permitted to be any arbitrary string which uniquely identifies an abstract location where state is stored persistently. It's even possible that the data in a single table is segmented in such a way that the table is effectively the union of multiple independent query spaces.
org.hibernate.annotations.Synchronize , org.hibernate.jpa.HibernateHints#HINT_NATIVE_SPACES
| Modifier and Type | Method and Description |
|---|---|
| public SynchronizeableQuery | Returns: this, for method chainingThe class of the entity. entityClass)Add all query spaces associated with the entity with the given type. |
| public SynchronizeableQuery | Returns: this, for method chainingThe name of an entity. entityName)Add all query spaces associated with the entity with the given names. |
| public SynchronizeableQuery | Returns: this, for method chainingThe name of the query space, usually the name of a database table. querySpace)Add a query space. |
| public Collection | Returns: The list of query spaces upon which the query is synchronized.Obtain the list of query spaces this query is synchronized with. |
| addSynchronizedEntityClass | back to summary |
|---|---|
| public SynchronizeableQuery addSynchronizedEntityClass(Class<?> entityClass) throws MappingException Add all query spaces associated with the entity with the given type.
Same as
| |
| addSynchronizedEntityName | back to summary |
|---|---|
| public SynchronizeableQuery addSynchronizedEntityName(String entityName) throws MappingException Add all query spaces associated with the entity with the given names.
Same as
| |
| addSynchronizedQuerySpace | back to summary |
|---|---|
| public SynchronizeableQuery addSynchronizedQuerySpace(String querySpace) Add a query space. The effect of this call is to:
| |
| getSynchronizedQuerySpaces | back to summary |
|---|---|
| public Collection Obtain the list of query spaces this query is synchronized with.
| |