public final class SharedTableEntities extends Object
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.
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isSharingTables(Object sessionFactory,
String entityName)
Check whether the tables of the given entity are also mapped by an entity from a different hierarchy.
|
public static boolean isSharingTables(Object sessionFactory, String entityName)
sessionFactory - the SessionFactory the entity persister belongs toentityName - the Hibernate entity nametrue if another entity hierarchy maps the same tables, or if the entity persisters
could not be resolvedCopyright © 2026. All rights reserved.