Package org.hibernate.ogm.grid

Examples of org.hibernate.ogm.grid.EntityKey


    //TODO this if won't work when we will support collections inside the entity tuple but that will do for now
    final TupleAsMapResultSet resultset = new TupleAsMapResultSet();
    if ( getEntityPersisters().length > 0 ) {
      OgmEntityPersister persister = getEntityPersisters()[0];
      final EntityKey key = EntityKeyBuilder.fromPersister( persister, id, session );
      Tuple entry = gridDialect.getTuple( key, persister.getTupleContext() );
      if ( entry != null ) {
        resultset.addTuple( entry );
      }
    }
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, this.getTupleContext() );
    checkVersionAndRaiseSOSE( id, currentVersion, session, resultset );
    gridVersionType.nullSafeSet( resultset, nextVersion, new String[] { getVersionColumnName() }, session );
    gridDialect.updateTuple( resultset, key );
    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

        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

  private void updateInverseSideOfAssociationNavigation(SessionImplementor session, 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

   */
  private void updateAssociatedEntityTableIfNeeded(SessionImplementor session, Map<String, Object> tuple, Action action) {
    if ( oneToMany ) {
      //update the associated object
      Serializable entityId = (Serializable) gridTypeOfAssociatedId.nullSafeGet( tuple, getElementColumnNames(), session, null );
      final EntityKey entityKey = new EntityKeyBuilder()
          .entityPersister( ( OgmEntityPersister ) getElementPersister() )
          .id( entityId )
          .getKey();
      final Cache<EntityKey,Map<String,Object>> entityCache = GridMetadataManagerHelper.getEntityCache(
          gridManager
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 = new EntityKeyBuilder().entityPersister( this ).id(id).getKey();
    final Map<String, Object> resultset = entityCache.get( key );
    checkVersionAndRaiseSOSE(id, currentVersion, session, resultset);
    gridVersionType.nullSafeSet( resultset, nextVersion, new String[] { getVersionColumnName() }, session );
    entityCache.put( key, resultset );
    return nextVersion;
View Full Code Here

    final Cache<EntityKey, Map<String, Object>> entityCache = GridMetadataManagerHelper.getEntityCache( session.getFactory() );
    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 = new EntityKeyBuilder().entityPersister( this ).id(id).getKey();
        Map<String, Object> resultset = entityCache.get( key );
        final boolean useVersion = j == 0 && isVersioned();

        resultset = createNewResultSetIfNull( resultset, id, session );
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.