Package org.hibernate.ogm.jdbc.impl

Examples of org.hibernate.ogm.jdbc.impl.TupleAsMapResultSet


  }

  @Override
  public Object readKey(ResultSet rs, String[] aliases, SessionImplementor session)
      throws HibernateException, SQLException {
    final TupleAsMapResultSet resultset = rs.unwrap( TupleAsMapResultSet.class );
    final Tuple keyTuple = resultset.getTuple();
    return keyGridType.nullSafeGet( keyTuple, aliases, session, null );
  }
View Full Code Here


  }

  @Override
  public Object readElement(ResultSet rs, Object owner, String[] aliases, SessionImplementor session)
      throws HibernateException, SQLException {
    final TupleAsMapResultSet resultset = rs.unwrap( TupleAsMapResultSet.class );
    final Tuple keyTuple = resultset.getTuple();
    return elementGridType.nullSafeGet( keyTuple, aliases, session, owner );
  }
View Full Code Here

  }

  @Override
  public Object readIdentifier(ResultSet rs, String alias, SessionImplementor session)
      throws HibernateException, SQLException {
    final TupleAsMapResultSet resultset = rs.unwrap( TupleAsMapResultSet.class );
    final Tuple keyTuple = resultset.getTuple();
    return identifierGridType.nullSafeGet( keyTuple, alias, session, null );
  }
View Full Code Here

      id = null;
    }
    else {
      id = qp.getCollectionKeys()[0];
    }
    TupleAsMapResultSet resultset = getResultSet( id, ogmLoadingContext, session );

    //Todo implement lockmode
    //final LockMode[] lockModesArray = getLockModes( queryParameters.getLockOptions() );
    //FIXME should we use subselects as it's closer to this process??

    //TODO is resultset a good marker, or should it be an ad-hoc marker??
    //It likely all depends on what resultset ends up being
    handleEmptyCollections( qp.getCollectionKeys(), resultset, session );

    final org.hibernate.engine.spi.EntityKey[] keys = new org.hibernate.engine.spi.EntityKey[entitySpan];

    //for each element in resultset
    //TODO should we collect List<Object> as result? Not necessary today
    Object result = null;
    List<Object> results = new ArrayList<Object>();
    try {
      while ( resultset.next() ) {
        result = getRowFromResultSet(
            resultset,
            session,
            qp,
            ogmLoadingContext,
View Full Code Here

  }

  @Override
  public Object readIndex(ResultSet rs, String[] aliases, SessionImplementor session)
      throws HibernateException, SQLException {
    final TupleAsMapResultSet resultset = rs.unwrap( TupleAsMapResultSet.class );
    final Tuple keyTuple = resultset.getTuple();
    return indexGridType.nullSafeGet( keyTuple, aliases, session, null );
  }
View Full Code Here

    if ( id == null && ogmLoadingContext.hasResultSet() ) {
      return ogmLoadingContext.getResultSet();
    }

    //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 );
      }
    }
    else {
      //collection persister
      if ( getCollectionPersisters().length != 1 ) {
        throw new AssertionFailure( "Found an unexpected number of collection persisters: " + getCollectionPersisters().length );
      }
      final OgmCollectionPersister persister = (OgmCollectionPersister) getCollectionPersisters()[0];
      Object owner = session.getPersistenceContext().getCollectionOwner( id, persister );

      AssociationPersister associationPersister = new AssociationPersister(
          persister.getOwnerEntityPersister().getMappedClass()
        )
        .gridDialect( gridDialect )
        .key( id, persister.getKeyGridType() )
        .associationKeyMetadata( persister.getAssociationKeyMetadata() )
        .associationTypeContext( persister.getAssociationTypeContext() )
        .hostingEntity( owner )
        .session( session );

      Association assoc = associationPersister.getAssociationOrNull();
      if ( assoc != null ) {
        for ( RowKey rowKey : assoc.getKeys() ) {
          resultset.addTuple( assoc.get( rowKey ) );
        }
      }
    }
    return resultset;
  }
View Full Code Here

  public void setTuples(List<Tuple> tuples) {
    if ( tuples == null ) {
      this.resultSet = null;
    }
    else {
      TupleAsMapResultSet tupleResultSet = new TupleAsMapResultSet();
      tupleResultSet.setTuples( tuples );
      this.resultSet = tupleResultSet;
    }
  }
View Full Code Here

  }

  @Override
  public Object readKey(ResultSet rs, String[] aliases, SessionImplementor session)
      throws HibernateException, SQLException {
    final TupleAsMapResultSet resultset = rs.unwrap( TupleAsMapResultSet.class );
    final Tuple keyTuple = resultset.getTuple();
    return keyGridType.nullSafeGet( keyTuple, aliases, session, null );
  }
View Full Code Here

  }

  @Override
  public Object readElement(ResultSet rs, Object owner, String[] aliases, SessionImplementor session)
      throws HibernateException, SQLException {
    final TupleAsMapResultSet resultset = rs.unwrap( TupleAsMapResultSet.class );
    final Tuple keyTuple = resultset.getTuple();
    return elementGridType.nullSafeGet( keyTuple, aliases, session, owner );
  }
View Full Code Here

  }

  @Override
  public Object readIdentifier(ResultSet rs, String alias, SessionImplementor session)
      throws HibernateException, SQLException {
    final TupleAsMapResultSet resultset = rs.unwrap( TupleAsMapResultSet.class );
    final Tuple keyTuple = resultset.getTuple();
    return identifierGridType.nullSafeGet( keyTuple, alias, session, null );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.ogm.jdbc.impl.TupleAsMapResultSet

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.