HHH-12351 - User Guide: document why Subselect always requires Synchronize

This commit is contained in:
Vlad Mihalcea 2018-07-03 14:27:17 +03:00
parent d8fe2ebdae
commit 4a9afdb8c7
1 changed files with 7 additions and 1 deletions

View File

@ -350,9 +350,15 @@ include::{sourcedir-mapping}/basic/SubselectTest.java[tag=mapping-Subselect-enti
----
====
[TIP]
====
The goal of the `@Synchronize` annotation in the `AccountSummary` entity mapping is to instruct Hibernate which database tables are needed by the
underlying `@Subselect` SQL query. This way, when executing a HQL or JPQL which selects from the `AccountSummary` entity,
underlying `@Subselect` SQL query. This is because, unlike JPQL and HQL queries, Hibernate cannot parse the underlying native SQL query.
With the `@Synchronize` annotation in place,
when executing a HQL or JPQL which selects from the `AccountSummary` entity,
Hibernate will trigger a Persistence Context flush if there are pending `Account`, `Client` or `AccountTransaction` entity state transitions.
====
[[entity-proxy]]
==== Define a custom entity proxy