public PersistentEntity getRootEntity() { PersistentEntity root = this; PersistentEntity parent = getParentEntity(); while (parent != null) { if(!parent.isInitialized()) { parent.initialize(); } root = parent; parent = parent.getParentEntity(); } return root; }
if(!parent.isInitialized()) { parent.initialize();
/** * Tries to obtain or create an associated entity. Note that if #canExpandMappingContext is set to false then this method may return null * * @param entity The main entity * @param context The context * @param propType The associated property type * @return The associated entity or null */ protected PersistentEntity getOrCreateAssociatedEntity(PersistentEntity entity, MappingContext context, Class propType) { PersistentEntity associatedEntity = context.getPersistentEntity(propType.getName()); if (associatedEntity == null) { if(canExpandMappingContext) { if (entity.isExternal()) { associatedEntity = context.addExternalPersistentEntity(propType); } else { associatedEntity = context.addPersistentEntity(propType); } } } else { if(!associatedEntity.isInitialized()) { associatedEntity.initialize(); } } return associatedEntity; }
protected void storeDateCreatedAndLastUpdatedInfo(PersistentEntity persistentEntity) { if(persistentEntity.isInitialized()) { ClassMapping<?> classMapping = persistentEntity.getMapping(); Entity mappedForm = classMapping.getMappedForm(); if(mappedForm == null || mappedForm.isAutoTimestamp()) { storeTimestampAvailability(entitiesWithDateCreated, persistentEntity, persistentEntity.getPropertyByName(DATE_CREATED_PROPERTY)); storeTimestampAvailability(entitiesWithLastUpdated, persistentEntity, persistentEntity.getPropertyByName(LAST_UPDATED_PROPERTY)); } } else { uninitializedEntities.add(persistentEntity.getName()); } }
if(!associatedEntity.isInitialized()) { associatedEntity.initialize();