Class SharedTableEntities
java.lang.Object
io.hypersistence.optimizer.hibernate.decorator.SharedTableEntities
The
SharedTableEntities resolves, once per SessionFactory, the entities whose tables are
also mapped by an entity belonging to a different hierarchy, as only those entities can trigger the
TableRowAlreadyManagedEvent.
The session decorators check this before scanning the persistence context on every entity load.
Otherwise, loading N entities in the same Session would take O(N^2) time, since each load
would iterate over all the entities already managed by the persistence context.
The entity persisters are resolved reflectively, as the metamodel API differs between Hibernate versions.
- Since:
- 2.14.0
- Author:
- Vlad Mihalcea
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisSharingTables(Object sessionFactory, String entityName) Check whether the tables of the given entity are also mapped by an entity from a different hierarchy.
-
Method Details
-
isSharingTables
Check whether the tables of the given entity are also mapped by an entity from a different hierarchy.- Parameters:
sessionFactory- theSessionFactorythe entity persister belongs toentityName- the Hibernate entity name- Returns:
trueif another entity hierarchy maps the same tables, or if the entity persisters could not be resolved
-