code: private Object initializeEntity(Object key, EntityMetadata entityMetadata)
              throws InstantiationException, IllegalAccessException
      {
          Object entity = null;
          entity = entityMetadata.getEntityClazz().newInstance();
          if (key != null)
          {
              PropertyAccessorHelper.setId(entity, entityMetadata, key);
          }
          return entity;
      }
docs: Initialize entity.
  
  @param key
  the key
  @param entityMetadata
  the entity metadata
  @return the object
  @throws InstantiationException
  the instantiation exception
  @throws IllegalAccessException
  the illegal access exception