Stefan S. created CAY-2678:
------------------------------
Summary: Inheritance warnings caused by unnecessary MappingCache
creations during initialization
Key: CAY-2678
URL: https://issues.apache.org/jira/browse/CAY-2678
Project: Cayenne
Issue Type: Bug
Components: Core Library
Affects Versions: 4.1
Reporter: Stefan S.
In my case, a lot of warnings labeled "No super entity mapping for
'superOEName'" floods the log during Cayenne start-up. The project consists of
multiple DataMaps, where some object entities in early loaded DataMaps are
derived from object entities declared in DataMaps loaded later. Although the
MappingCache is refreshed after all DataMaps are loaded, a cache instance is
created / accessed while adding DataMaps (see call stack below).
*In Detail:*
{code:java}
org.apache.cayenne.map.EntityResolver::addDataMap(...)
{code}
checks for duplicated names (checkForDuplicatedNames()), which queries the DB
entities via
{code:java}
EntityResolver::getDbEntity(...)
{code}
EntityResolver::getDbEntity(...) resolves the entity from the MappingCache
instance, which contains only DataMaps loaded so far. The cache tries to fully
resolve the object entities including their inheritance tree, which is not yet
available due to DataMaps loaded at a later point in time.
*Resolution Proposal:*
Decoupling of entity resolution for duplicate name checks during DataMap
loading from building the cache with fully resolved object entities after all
DataMaps have been loaded.
*Call-Stack:*
Thread [AWT-EventQueue-0] (Suspended (breakpoint at line 112 in MappingCache))
Thread [AWT-EventQueue-0] (Suspended (breakpoint at line 112 in MappingCache))
owns: EntityResolver$1 (id=1307) owns: EntityResolver (id=68)
MappingCache.index() line: 112 MappingCache.<init>(Collection<DataMap>) line:
65 EntityResolver$1.createDelegate() line: 417
EntityResolver$1.createDelegate() line: 413
EntityResolver$1(ProxiedMappingNamespace).getDelegate() line: 38
EntityResolver$1(ProxiedMappingNamespace).getDbEntity(String) line: 69
EntityResolver.getDbEntity(String) line: 255
EntityResolver.checkForDuplicatedNames(DataMap) line: 375
EntityResolver.addDataMap(DataMap) line: 360
ProjectController.updateEntityResolver() line: 313
ProjectController.setProject(Project) line: 303
CayenneModelerController.projectOpenedAction(Project) line: 207
OpenProjectAction.openProjectResourse(Resource, CayenneModelerController) line:
184 OpenProjectAction.openProject(File) line: 175 Main$1.run() line: 100
--
This message was sent by Atlassian Jira
(v8.3.4#803005)