Package org.hibernate.ogm.grid

Examples of org.hibernate.ogm.grid.EntityKey


        keyColumnNames.add( columnName );
        keyColumnValues.add( rowKey.getColumnValues()[i] );
      }
      i++;
    }
    return new EntityKey( new EntityKeyMetadata( associationKey.getTable(), keyColumnNames.toArray( new String[keyColumnNames.size()] ) ),
        keyColumnValues.toArray( new Object[keyColumnValues.size()] ) );
  }
View Full Code Here


   * @param associationKey identify the type of the relationship
   * @param rowKey identify the relationship
   * @return the corresponding relationship
   */
  public Relationship findRelationship(AssociationKey associationKey, RowKey rowKey) {
    EntityKey entityKey = associationKey.getEntityKey();
    Map<String, Object> parameters = new HashMap<String, Object>( entityKey.getColumnNames().length + rowKey.getColumnNames().length );
    StringBuilder query = new StringBuilder( "MATCH" );
    appendNodePattern( entityKey, parameters, query, ENTITY );
    query.append( " - " );
    query.append( relationshipCypher( associationKey, rowKey, parameters, entityKey.getColumnNames().length ) );
    query.append( " - () RETURN r" );
    ExecutionResult result = engine.execute( query.toString(), parameters );
    ResourceIterator<Relationship> column = result.columnAs( "r" );
    Relationship relationship = null;
    if ( column.hasNext() ) {
View Full Code Here

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

      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

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

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

    if ( INSERT == snapshot.getOperationType() && columnNamesAllowBatchInsert( tupleOperation ) ) {
View Full Code Here

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

    }
    return values;
  }

  private Tuple getResultsetById(Serializable id, SessionImplementor session) {
    final EntityKey key = EntityKeyBuilder.fromPersister( this, id, session );
    final Tuple resultset = gridDialect.getTuple( key, this.getTupleContext() );
    return resultset;
  }
View Full Code Here

    /*
     * We get the value from the grid and compare the version values before putting the next version in
     * Contrary to the database version, there is
     * TODO should we use cache.replace() it seems more expensive to pass the resultset around "just" the atomicity of the operation
     */
    final EntityKey key = EntityKeyBuilder.fromPersister( this, id, session );
    final Tuple resultset = gridDialect.getTuple( key, getTupleContext() );
    checkVersionAndRaiseSOSE( id, currentVersion, session, resultset );
    gridVersionType.nullSafeSet( resultset, nextVersion, new String[] { getVersionColumnName() }, session );
    gridDialect.updateTuple( resultset, key, getTupleContext() );
    return nextVersion;
View Full Code Here

    }

    for ( int j = 0; j < span; j++ ) {
      // Now update only the tables with dirty properties (and the table with the version number)
      if ( tableUpdateNeeded[j] ) {
        final EntityKey key = EntityKeyBuilder.fromPersister( this, id, session );
        Tuple resultset = gridDialect.getTuple( key, this.getTupleContext() );
        final boolean useVersion = j == 0 && isVersioned();

        resultset = createNewResultSetIfNull( key, resultset, id, session );
View Full Code Here

        if ( j == 0 && isVersioned() ) {
          log.trace( "Version: " + Versioning.getVersion( fields, this ) );
        }
      }

      final EntityKey key = EntityKeyBuilder.fromPersister( this, id, session );
      Tuple resultset = gridDialect.getTuple( key, this.getTupleContext() );
      // add the discriminator
      if ( j == 0 ) {
        if (resultset != null) {
          throw new HibernateException( "trying to insert an already existing entity: "
View Full Code Here

TOP

Related Classes of org.hibernate.ogm.grid.EntityKey

Copyright © 2018 www.massapicom. 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.