docs: protected final Object getIdentifier(Object value, SessionFactoryImplementor sessionFactory) throws HibernateException {
  		if ( value == null ) {
  			return null;
  		}
  
  		final EntityPersister persister = sessionFactory.getMetamodel().entityPersister( delegate.getAssociatedEntityName() );
  		final String uniqueKeyPropertyName = delegate.getRHSUniqueKeyPropertyName();
  
  		if ( StringHelper.isEmpty( uniqueKeyPropertyName ) ) {
  			return persister.getIdentifier( value, null );
  		}
  		else {
  			Object propertyValue = persister.getPropertyValue( value, uniqueKeyPropertyName );
  			// We now have the value of the property-ref we reference.  However,
  			// we need to dig a little deeper, as that property might also be
  			// an entity type, in which case we need to resolve its identifier
  			Type type = persister.getPropertyType( uniqueKeyPropertyName );
  			GridType gridType = typeTranslator.getType( type );
  			if ( gridType.isEntityType() ) {
  				propertyValue = getIdentifier( propertyValue, sessionFactory );
  			}
  
  			return propertyValue;
  		}
  	}