Examples of EntityKeyMetadata


Examples of org.hibernate.ogm.model.key.spi.EntityKeyMetadata

    return new EntityDocument( createEntityKey( "tableName", new String[] { "id", "name" }, new String[] { "1",
        "Andrea" } ) );
  }

  private EntityKey createEntityKey(String tableName, String[] columnNames, Object[] values) {
    return new EntityKey( new EntityKeyMetadata( tableName, columnNames ), values );
  }
View Full Code Here

Examples of org.hibernate.ogm.model.key.spi.EntityKeyMetadata

  @Override
  public ClosableIterator<Tuple> executeBackendQuery(BackendQuery<MongoDBQueryDescriptor> backendQuery, QueryParameters queryParameters) {
    MongoDBQueryDescriptor queryDescriptor = backendQuery.getQuery();

    EntityKeyMetadata entityKeyMetadata = backendQuery.getSingleEntityKeyMetadataOrNull();
    String collectionName = getCollectionName( backendQuery, queryDescriptor, entityKeyMetadata );
    DBCollection collection = provider.getDatabase().getCollection( collectionName );

    switch( queryDescriptor.getOperation() ) {
      case FIND:
View Full Code Here

Examples of org.hibernate.ogm.model.key.spi.EntityKeyMetadata

   *
   * @return the {@link EntityKeyMetadata} of the entity type selected by this query or {@code null} in case this
   * query does not select exactly one entity type (e.g. in case of scalar values or joins (if supported in future revisions)).
   */
  private EntityKeyMetadata getSingleEntityKeyMetadataOrNull(Type[] queryReturnTypes) {
    EntityKeyMetadata metadata = null;

    for ( Type queryReturn : queryReturnTypes ) {
      if ( queryReturn instanceof EntityType ) {
        if ( metadata != null ) {
          return null;
        }
        EntityType rootReturn = (EntityType) queryReturn;
        OgmEntityPersister persister = (OgmEntityPersister) sessionFactory.getEntityPersister( rootReturn.getName() );
        metadata = new EntityKeyMetadata( persister.getTableName(), persister.getRootTableIdentifierColumnNames() );
      }
    }

    return metadata;
  }
View Full Code Here

Examples of org.hibernate.ogm.model.key.spi.EntityKeyMetadata

    transaction = session.beginTransaction();
    b = (Bookmark) session.get( Bookmark.class, b.getId() );

    //Check directly in the cache the values stored
    EntityKeyMetadata keyMetadata = new EntityKeyMetadata( "Bookmark", new String[]{ "id" } );
    EntityKey key = new EntityKey( keyMetadata, new Object[]{ "42" } );
    Map<String, Object> entity = extractEntityTuple( sessions, key );

    assertEquals( "Entity visits count incorrect", entity.get( "visits_count" ), "444" );
    assertEquals( "Entity serial number incorrect", entity.get( "serialNumber" ), serialNumber.toString() );
View Full Code Here

Examples of org.hibernate.ogm.model.key.spi.EntityKeyMetadata

      gridPropertyTypes[index] = typeTranslator.getType( types[index] );
    }
    gridVersionType = typeTranslator.getType( getVersionType() );
    gridIdentifierType = typeTranslator.getType( getIdentifierType() );
    jpaEntityName = persistentClass.getJpaEntityName();
    entityKeyMetadata = new EntityKeyMetadata( getTableName(), getIdentifierColumnNames() );

    initCustomSQLStrings();

    propertyMightRequireInverseAssociationManagement = getPropertyMightRequireInverseAssociationManagement();
    mightRequireInverseAssociationManagement = initMayManageInverseAssociations();
View Full Code Here

Examples of org.hibernate.ogm.model.key.spi.EntityKeyMetadata

    transaction.commit();

    session.clear();

    transaction = session.beginTransaction();
    EntityKey key = new EntityKey( new EntityKeyMetadata( "Feeling", new String[] { "UUID" } ), new Object[] { feeling.getUUID() } );
    Map<String, Object> entityTuple = extractEntityTuple( sessions, key );
    final Tuple tuple = new Tuple( new MapTupleSnapshot( entityTuple ) );

    EntityPersister persister = ( (SessionFactoryImplementor) session.getSessionFactory() )
        .getEntityPersister( Feeling.class.getName() );
View Full Code Here

Examples of org.hibernate.ogm.model.key.spi.EntityKeyMetadata

    Assertions.assertThat( 1 ).isEqualTo( queue.size() );
  }

  private EntityKey entityKey() {
    EntityKeyMetadata keyMetadata = new EntityKeyMetadata( "MetadataTable", new String[] {} );
    EntityKey key = new EntityKey( keyMetadata, new Object[] {} );
    return key;
  }
View Full Code Here

Examples of org.hibernate.ogm.model.key.spi.EntityKeyMetadata

    this.singleEntityKeyMetadata = determineSingleEntityKeyMetadata( factory, customQueryReturns );
  }

  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 EntityKeyMetadata( persister.getTableName(), persister.getRootTableIdentifierColumnNames() );
      }
    }

    return metadata;
  }
View Full Code Here

Examples of org.hibernate.ogm.model.key.spi.EntityKeyMetadata

  private Map<EntityKeyMetadata, Neo4jEntityQueries> initializeEntityQueries(SessionFactoryImplementor sessionFactoryImplementor,
      Map<AssociationKeyMetadata, Neo4jAssociationQueries> associationQueries) {
    Map<EntityKeyMetadata, Neo4jEntityQueries> entityQueries = initializeEntityQueries( sessionFactoryImplementor );
    for ( AssociationKeyMetadata associationKeyMetadata : associationQueries.keySet() ) {
      EntityKeyMetadata entityKeyMetadata = associationKeyMetadata.getAssociatedEntityKeyMetadata().getEntityKeyMetadata();
      if ( !entityQueries.containsKey( entityKeyMetadata ) ) {
        // Embeddables metadata
        entityQueries.put( entityKeyMetadata, new Neo4jEntityQueries( entityKeyMetadata ) );
      }
    }
View Full Code Here

Examples of org.hibernate.ogm.model.key.spi.EntityKeyMetadata

    Map<AssociationKeyMetadata, Neo4jAssociationQueries> queryMap = new HashMap<AssociationKeyMetadata, Neo4jAssociationQueries>();
    Collection<CollectionPersister> collectionPersisters = sessionFactoryImplementor.getCollectionPersisters().values();
    for ( CollectionPersister collectionPersister : collectionPersisters ) {
      if ( collectionPersister instanceof OgmCollectionPersister ) {
        OgmCollectionPersister ogmCollectionPersister = (OgmCollectionPersister) collectionPersister;
        EntityKeyMetadata ownerEntityKeyMetadata = ( (OgmEntityPersister) ( ogmCollectionPersister.getOwnerEntityPersister() ) ).getEntityKeyMetadata();
        AssociationKeyMetadata associationKeyMetadata = ogmCollectionPersister.getAssociationKeyMetadata();
        queryMap.put( associationKeyMetadata, new Neo4jAssociationQueries( ownerEntityKeyMetadata, associationKeyMetadata ) );
      }
    }
    return queryMap;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.