code: @Override
      public Metamodel getMetamodel()
      {
          if (isOpen())
          {
              MetamodelImpl metamodel = null;
              for (String pu : persistenceUnits)
              {
                  metamodel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(pu);
  
                  if (metamodel != null)
                  {
                      return metamodel;
                  }
              }
              // return
              // KunderaMetadataManager.getMetamodel(getPersistenceUnits());
          }
          throw new IllegalStateException("Entity manager factory has been closed.");
      }
docs: Return an instance of Metamodel interface for access to the metamodel of
  the persistence unit.
  
  @return Metamodel instance
  @throws IllegalStateException
  if the entity manager factory has been closed
  @see javax.persistence.EntityManagerFactory#getMetamodel()