public List<EntityHierarchyImpl> groupEntityHierarchies() { while (!extendsQueue.isEmpty()) { // set up a pass over the queue int numberOfMappingsProcessed = 0; Iterator<ExtendsQueueEntry> iterator = extendsQueue.iterator(); while (iterator.hasNext()) { final ExtendsQueueEntry entry = iterator.next(); final SubclassEntityContainer container = subEntityContainerMap.get(entry.entityItExtends); if (container != null) { // we now have this entity's super, attach it and remove entry from extends queue container.add(entry.subClassEntitySource); iterator.remove(); numberOfMappingsProcessed++; } } if (numberOfMappingsProcessed == 0) { // todo : we could log the waiting dependencies... throw currentMappingDocument .getMappingLocalBindingContext() .makeMappingException("Unable to process extends dependencies in hbm files"); } } return entityHierarchies; }
private void processNamedQueries(EntityElement entityElement) { // For backward compatibility, store named queries prefixed with // the class name. String queryNamePrefix = entityElement.getEntityName(); queryNamePrefix = StringHelper.isNotEmpty(queryNamePrefix) ? queryNamePrefix : currentMappingDocument .getMappingLocalBindingContext() .qualifyClassName(entityElement.getName()); for (final JaxbQueryElement element : entityElement.getQuery()) { element.setName(queryNamePrefix + "." + element.getName()); NamedQueryBindingHelper.bindNamedQuery(element, metadata); } for (final JaxbSqlQueryElement element : entityElement.getSqlQuery()) { element.setName(queryNamePrefix + "." + element.getName()); NamedQueryBindingHelper.bindNamedSQLQuery( element, currentMappingDocument.getMappingLocalBindingContext(), metadata); } }
private void processSubclassElement(SubEntityElement element) { // we have to see if this things super-type has been found yet, and if not add it to the // extends queue final String entityItExtends = currentMappingDocument .getMappingLocalBindingContext() .qualifyClassName(element.getExtends()); final SubclassEntityContainer container = subEntityContainerMap.get(entityItExtends); final SubclassEntitySourceImpl subClassEntitySource = createSubClassEntitySource(element, (EntitySource) container); final String entityName = subClassEntitySource.getEntityName(); subEntityContainerMap.put(entityName, subClassEntitySource); processSubElements(element, subClassEntitySource); if (container != null) { // we already have this entity's super, attach it and continue container.add(subClassEntitySource); } else { // we do not yet have the super and have to wait, so add it fto the extends queue extendsQueue.add(new ExtendsQueueEntry(subClassEntitySource, entityItExtends)); } }