code: private CompositeObject createByExample(Map<PrimitivePropertyMethodMetadata<PropertyMetadata>, Object> exampleEntity, Class<?> type, Class<?>... types) {
          DynamicType<EntityTypeMetadata<EntityMetadata>> effectiveTypes = sessionContext.getMetadataProvider().getEffectiveTypes(type, types);
          Set<EntityDiscriminator> entityDiscriminators = sessionContext.getMetadataProvider().getEntityDiscriminators(effectiveTypes);
          DatastoreSession<EntityId, Entity, EntityMetadata, EntityDiscriminator, RelationId, Relation, RelationMetadata, RelationDiscriminator, PropertyMetadata> datastoreSession = sessionContext
                  .getDatastoreSession();
          Entity entity = datastoreSession.getDatastoreEntityManager().createEntity(effectiveTypes, entityDiscriminators, exampleEntity);
          AbstractInstanceManager<EntityId, Entity> entityInstanceManager = sessionContext.getEntityInstanceManager();
          CompositeObject instance = entityInstanceManager.createInstance(entity, effectiveTypes);
          sessionContext.getInstanceListenerService().postCreate(instance);
          return instance;
      }
docs: Create a new {@link CompositeObject} instance using an example.
  
  @param exampleEntity
  The example instance.
  @param type
  The interface the property type shall implement.
  @param types
  Additional interfaces the entity type shall implement.
  @return The {@link CompositeObject} instance.