Examples of EntityKey


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

  private void updateInverseSideOfAssociationNavigation(SessionImplementor session, Object entity, Tuple associationRow, Action action, RowKey rowKey) {
    if ( associationType == AssociationType.EMBEDDED_FK_TO_ENTITY ) {
      // update the associated object
      Serializable entityId = (Serializable) gridTypeOfAssociatedId.nullSafeGet( associationRow, getElementColumnNames(), session, null );
      OgmEntityPersister persister = (OgmEntityPersister) getElementPersister();
      final EntityKey entityKey = EntityKeyBuilder.fromPersister( persister, entityId, session );

      final Tuple entityTuple = gridDialect.getTuple( entityKey, persister.getTupleContext() );
      // the entity tuple could already be gone (not 100% sure this can happen but that feels right)
      if ( entityTuple == null ) {
        return;
View Full Code Here

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

  @Override
  public void lock(Serializable id, Object version, Object object, int timeout, SessionImplementor session)
      throws StaleObjectStateException, JDBCException {
    AdvancedCache advCache = getProvider( session ).getCache( ENTITY_CACHE ).getAdvancedCache();
    EntityKey key = EntityKeyBuilder.fromData(
        ( (OgmEntityPersister) lockable).getRootEntityKeyMetadata(),
        identifierGridType,
        id,
        session );
    advCache.lock( key );
View Full Code Here

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

    String tableName = input.readUTF();
    String[] columnNames = (String[]) input.readObject();
    Object[] values = (Object[]) input.readObject();

    return new EntityKey( new EntityKeyMetadata( tableName, columnNames ), values );
  }
View Full Code Here

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

        id,
        identifierGridType,
        entityKeyMetadata.getColumnNames(),
        session
    );
    return new EntityKey( entityKeyMetadata, values );
  }
View Full Code Here

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

    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.EntityKey

      queue.close();
    }
  }

  private void executeBatchRemove(Map<DBCollection, BatchInsertionTask> inserts, RemoveTupleOperation tupleOperation) {
    EntityKey entityKey = tupleOperation.getEntityKey();
    DBCollection collection = getCollection( entityKey );
    BatchInsertionTask batchedInserts = inserts.get( collection );

    if ( batchedInserts != null && batchedInserts.containsKey( entityKey ) ) {
      batchedInserts.remove( entityKey );
View Full Code Here

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

      removeTuple( entityKey, tupleOperation.getTupleContext() );
    }
  }

  private void executeBatchUpdate(Map<DBCollection, BatchInsertionTask> inserts, InsertOrUpdateTupleOperation tupleOperation) {
    EntityKey entityKey = tupleOperation.getEntityKey();
    Tuple tuple = tupleOperation.getTuple();
    MongoDBTupleSnapshot snapshot = (MongoDBTupleSnapshot) tupleOperation.getTuple().getSnapshot();
    WriteConcern writeConcern = getWriteConcern( tupleOperation.getTupleContext() );

    if ( INSERT == snapshot.getSnapshotType() ) {
View Full Code Here

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

  private AssociationKey getAssociationKey() {
    if ( associationKey == null ) {
      final Object[] columnValues = getKeyColumnValues();

      EntityKey ownerEntityKey;
      if ( key != null ) {
        ownerEntityKey = EntityKeyBuilder.fromPersister(
            (OgmEntityPersister) getHostingEntityPersister(),
            (Serializable) key,
            session );
      }
      else {
        ownerEntityKey  = new EntityKey(
            ((OgmEntityPersister) getHostingEntityPersister()).getEntityKeyMetadata(),
            columnValues
        );
      }
View Full Code Here

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

    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() );
    assertEquals( "Entity URL incorrect", entity.get( "url" ), "http://www.hibernate.org/" );
View Full Code Here

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

  }

  @Override
  public void lock(Serializable id, Object version, Object object, int timeout, SessionImplementor session) throws StaleObjectStateException, JDBCException {
    MapDatastoreProvider dataStore = getProvider( session );
    EntityKey key = EntityKeyBuilder.fromData(
        ( (OgmEntityPersister) lockable).getRootEntityKeyMetadata(),
        identifierGridType,
        id,
        session );
    dataStore.writeLock( key, timeout );
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.