Examples of EntityKey


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.readLock( key, timeout );
View Full Code Here

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

    }
    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

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

    /*
     * 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.insertOrUpdateTuple( key, resultset, getTupleContext() );
    return nextVersion;
View Full Code Here

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


    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 = null;

        if ( mightRequireInverseAssociationManagement || usesNonAtomicOptimisticLocking ) {
          resultset = gridDialect.getTuple( key, getTupleContext() );
        }
View Full Code Here

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

        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

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

    final int span = getTableSpan();
    if ( span > 1 ) {
      throw new HibernateException( "Hibernate OGM does not yet support entities spanning multiple tables");
    }

    final EntityKey key = EntityKeyBuilder.fromPersister( this, id, session );
    Object[] loadedState = getLoadedState( id, session );
    Tuple currentState = null;

    if ( mightRequireInverseAssociationManagement || usesNonAtomicOptimisticLocking ) {
      currentState = gridDialect.getTuple( key, getTupleContext() );
View Full Code Here

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

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

    queue.poll();
  }

  @Test
  public void testContainsKeyWhenAddingUpdateTupleOperation() throws Exception {
    EntityKey key = entityKey();
    InsertOrUpdateTupleOperation expected = new InsertOrUpdateTupleOperation( null, key, emptyTupleContext() );
    queue.add( expected );

    Assertions.assertThat( queue.contains( key ) ).isTrue();
  }
View Full Code Here

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

    Assertions.assertThat( queue.contains( key ) ).isTrue();
  }

  @Test
  public void testContainsKeyIsFalseWhenAddingRemoveTupleOperation() throws Exception {
    EntityKey key = entityKey();
    RemoveTupleOperation expected = new RemoveTupleOperation( key, emptyTupleContext() );
    queue.add( expected );

    Assertions.assertThat( queue.contains( key ) ).isFalse();
  }
View Full Code Here

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

    Assertions.assertThat( queue.contains( key ) ).isFalse();
  }

  @Test
  public void testAddRemoveTupleOperation() throws Exception {
    EntityKey key = entityKey();
    RemoveTupleOperation expected = new RemoveTupleOperation( key, emptyTupleContext() );
    queue.add( expected );

    Assertions.assertThat( expected ).isEqualTo( queue.poll() );
  }
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.