code: public void bindRoot(HibernatePersistentEntity entity, InFlightMetadataCollector mappings, String sessionFactoryBeanName) {
          if (mappings.getEntityBinding(entity.getName()) != null) {
              LOG.info("[GrailsDomainBinder] Class [" + entity.getName() + "] is already mapped, skipping.. ");
              return;
          }
  
          RootClass root = new RootClass(this.metadataBuildingContext);
          root.setAbstract(entity.isAbstract());
          final MappingContext mappingContext = entity.getMappingContext();
  
  
  
          final java.util.Collection<PersistentEntity> children = mappingContext.getDirectChildEntities(entity);
          if (children.isEmpty()) {
              root.setPolymorphic(false);
          }
          bindClass(entity, root, mappings);
  
          Mapping m = getMapping(entity);
  
          bindRootPersistentClassCommonValues(entity, root, mappings, sessionFactoryBeanName);
  
          if (!children.isEmpty()) {
              boolean tablePerSubclass = m != null && !m.getTablePerHierarchy();
              if (!tablePerSubclass) {
                  // if the root class has children create a discriminator property
                  bindDiscriminatorProperty(root.getTable(), root, mappings);
              }
              // bind the sub classes
              bindSubClasses(entity, root, mappings, sessionFactoryBeanName);
          }
  
          addMultiTenantFilterIfNecessary(entity, root, mappings, sessionFactoryBeanName);
  
          mappings.addEntityBinding(root);
      }
docs: Binds a root class (one with no super classes) to the runtime meta model
  based on the supplied Grails domain class
  
  @param entity The Grails domain class
  @param mappings    The Hibernate Mappings object
  @param sessionFactoryBeanName  the session factory bean name