Package org.hibernate.ogm.grid

Examples of org.hibernate.ogm.grid.EntityKey


        EntityEntry entry = session.getPersistenceContext().getEntry( entity );
        loadedState = entry.getLoadedState();
      }
    }

    final EntityKey key = EntityKeyBuilder.fromPersister( this, id, session );
    final Tuple resultset = gridDialect.getTuple( key, this.getTupleContext() );
    final SessionFactoryImplementor factory = getFactory();
    if ( isImpliedOptimisticLocking && loadedState != null ) {
      // we need to utilize dynamic delete statements
      for ( int j = span - 1; j >= 0; j-- ) {
View Full Code Here


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

      getElementGridType().nullSafeSet( tuple, element, getElementColumnNames(), session );

    }

    RowKeyAndTuple result = new RowKeyAndTuple();
    EntityKey entityKey = associationPersister.createTargetKey( rowKeyBuilder.getColumnNames(), tuple );
    result.key = rowKeyBuilder.values( tuple ).entityKey( entityKey ).build();

    Tuple assocEntryTuple = associationPersister.createAndPutAssociationTuple( result.key );
    for ( String column : tuple.getColumnNames() ) {
      assocEntryTuple.put( column, tuple.get( column ) );
View Full Code Here

  private void updateInverseSideOfAssociationNavigation(SessionImplementor session, Object entity, Tuple tuple, Action action, RowKey rowKey) {
    if ( associationType == AssociationType.EMBEDDED_FK_TO_ENTITY ) {
      // update the associated object
      Serializable entityId = (Serializable) gridTypeOfAssociatedId.nullSafeGet( tuple, 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

      associationPersister.flushToCache();
    }
  }

  private RowKey updateRowKeyEntityKey(RowKey rowKey, AssociationPersister associationPersister) {
    EntityKey targetKey = associationPersister.createTargetKey( rowKey.getColumnNames(), rowKey.getColumnValues() );
    return new RowKey( rowKey.getTable(), rowKey.getColumnNames(), rowKey.getColumnValues(), targetKey );
  }
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

      throw new AssertionFailure( "Unrecognized row key node: " + rowKeyNode );
    }
  }

  private PropertyContainer findEntityOrCreateTempNode(AssociationKey associationKey, RowKey rowKey) {
    EntityKey endNodeKey = endNodeKey( associationKey, rowKey );
    Node endNode = neo4jCRUD.findNode( endNodeKey, ENTITY );
    if ( endNode == null ) {
      // We cannot find the entity on the other side of the relationship, we store the information related to
      // the RowKey in a temporary node and we create a relationship to it
      return createRelationshipToTempNode( associationKey, rowKey );
View Full Code Here

        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

    inverseRelationship.getEndNode().delete();
    return newInverseRelationship;
  }

  private PropertyContainer createRelationshipWithEntity(AssociationKey associationKey, RowKey rowKey, Node node) {
    EntityKey ownerEntityKey = associationKey.getEntityKey();
    Node ownerNode = neo4jCRUD.findNode( ownerEntityKey, ENTITY );
    Relationship relationship = ownerNode.createRelationshipTo( node, relationshipType( associationKey ) );
    applyColumnValues( rowKey, relationship );
    return relationship;
  }
View Full Code Here

      throw new AssertionFailure( "Unrecognized row key node: " + rowKeyNode );
    }
  }

  private PropertyContainer findEntityOrCreateTempNode(AssociationKey associationKey, RowKey rowKey) {
    EntityKey endNodeKey = endNodeKey( associationKey, rowKey );
    Node endNode = neo4jCRUD.findNode( endNodeKey, ENTITY );
    if ( endNode == null ) {
      // We cannot find the entity on the other side of the relationship, we store the information related to
      // the RowKey in a temporary node and we create a relationship to it
      return createNodeAndAddRelationship( associationKey, rowKey, TEMP_NODE );
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.