Ejemplo n.º 1
0
 private Map<EntityKeyMetadata, EmbeddedNeo4jEntityQueries> initializeEntityQueries(
     SessionFactoryImplementor sessionFactoryImplementor) {
   Map<EntityKeyMetadata, EmbeddedNeo4jEntityQueries> queryMap =
       new HashMap<EntityKeyMetadata, EmbeddedNeo4jEntityQueries>();
   Collection<EntityPersister> entityPersisters =
       sessionFactoryImplementor.getEntityPersisters().values();
   for (EntityPersister entityPersister : entityPersisters) {
     if (entityPersister instanceof OgmEntityPersister) {
       OgmEntityPersister ogmEntityPersister = (OgmEntityPersister) entityPersister;
       queryMap.put(
           ogmEntityPersister.getEntityKeyMetadata(),
           new EmbeddedNeo4jEntityQueries(ogmEntityPersister.getEntityKeyMetadata()));
     }
   }
   return queryMap;
 }
Ejemplo n.º 2
0
  private EntityMetadataInformation determineSingleEntityMetadataInformation(
      SessionFactoryImplementor sessionFactory, List<Return> customQueryReturns) {
    EntityMetadataInformation metadataInformation = null;

    for (Return queryReturn : customQueryReturns) {
      if (queryReturn instanceof RootReturn) {
        if (metadataInformation != null) {
          return null;
        }
        RootReturn rootReturn = (RootReturn) queryReturn;
        OgmEntityPersister persister =
            (OgmEntityPersister) sessionFactory.getEntityPersister(rootReturn.getEntityName());
        metadataInformation =
            new EntityMetadataInformation(
                persister.getEntityKeyMetadata(), rootReturn.getEntityName());
      }
    }

    return metadataInformation;
  }
Ejemplo n.º 3
0
  private static EntityKeyMetadata determineSingleEntityKeyMetadata(
      SessionFactoryImplementor sessionFactory, List<Return> customQueryReturns) {
    EntityKeyMetadata metadata = null;

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

    return metadata;
  }