code: protected void addMultiTenantFilterIfNecessary(
              HibernatePersistentEntity entity, PersistentClass persistentClass,
              InFlightMetadataCollector mappings, String sessionFactoryBeanName) {
          if (entity.isMultiTenant()) {
              TenantId tenantId = entity.getTenantId();
  
              if (tenantId != null) {
                  String filterCondition = getMultiTenantFilterCondition(sessionFactoryBeanName, entity);
  
                  persistentClass.addFilter(
                          GormProperties.TENANT_IDENTITY,
                          filterCondition,
                          true,
                          Collections.emptyMap(),
                          Collections.emptyMap()
                  );
  
                  mappings.addFilterDefinition(new FilterDefinition(
                          GormProperties.TENANT_IDENTITY,
                          filterCondition,
                          Collections.singletonMap(GormProperties.TENANT_IDENTITY, persistentClass.getProperty(tenantId.getName()).getType())
                  ));
              }
          }
      }
docs: Add a Hibernate filter for multitenancy if the persistent class is multitenant
  
  @param entity target persistent entity for get tenant information
  @param persistentClass persistent class for add the filter and get tenant property info
  @param mappings mappings to add the filter
  @param sessionFactoryBeanName the session factory bean name