| When I read the section Mapping the entity to a SQL query, I wondered whether the @Synchronize annotation was really necessary. All tables that are mentioned are also mentioned in the corresponding @Subselect and could easily extracted from there. To test whether the annotation was redundant, I removed it from the SubselectTest. Running the test gave me a javax.persistence.NoResultException: No entity found for query. I find this exception highly unintuitive. I had expected the test to succeed at the first query and fail at the second query because the entity is just not updated. (Or, that everything just works because the affected tables are inferred.) The current behavior is unintuitive and should either be explained in the documentation or be fixed to one of the above expectations. |