private void initializePersistentEntity(PersistentEntity entity) { try { entity.initialize(); parent.initialize();
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 (entity.isExternal()) { associatedEntity = context.addExternalPersistentEntity(type); associatedEntity.initialize(); associatedEntity.initialize(); embeddedEntity.initialize(); return embeddedEntity; associatedEntity.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; }