for ( Return queryReturn : getCustomQueryReturns() ) {
if ( queryReturn instanceof RootReturn ) {
if ( metadata != null ) {
return null;
}
RootReturn rootReturn = (RootReturn) queryReturn;
OgmEntityPersister persister = (OgmEntityPersister) sessionFactory.getEntityPersister( rootReturn.getEntityName() );
metadata = new EntityKeyMetadata( persister.getTableName(), persister.getRootTableIdentifierColumnNames() );
}
}
return metadata;