Package org.hibernate.ogm.loader.impl

Examples of org.hibernate.ogm.loader.impl.OgmLoader


    }
  }

  private Object entity(Session session, Tuple tuple) {
    OgmEntityPersister persister = (OgmEntityPersister) sessionFactory.getEntityPersister( indexedType.getName() );
    OgmLoader loader = new OgmLoader( new OgmEntityPersister[] { persister } );
    List<Tuple> tuples = new ArrayList<Tuple>();
    tuples.add( tuple );
    OgmLoadingContext ogmLoadingContext = new OgmLoadingContext();
    ogmLoadingContext.setTuples( tuples );
    List<Object> entities = loader.loadEntities( (SessionImplementor) session, LockOptions.NONE, ogmLoadingContext );
    return entities.get( 0 );
  }
View Full Code Here


  private List<Object> listOfEntities(SessionImplementor session, Type[] resultTypes, ClosableIterator<Tuple> tuples) {
    List<Object> results = new ArrayList<Object>();
    Class<?> returnedClass = resultTypes[0].getReturnedClass();
    while ( tuples.hasNext() ) {
      Tuple tuple = tuples.next();
      OgmLoader loader = createLoader( session, returnedClass );
      results.add( entity( session, tuple, loader ) );
    }
    return results;
  }
View Full Code Here

  private List<Object> listOfEntities(SessionImplementor session, Type[] resultTypes, ClosableIterator<Tuple> tuples) {
    List<Object> results = new ArrayList<Object>();
    Class<?> returnedClass = resultTypes[0].getReturnedClass();
    while ( tuples.hasNext() ) {
      Tuple tuple = tuples.next();
      OgmLoader loader = createLoader( session, returnedClass );
      results.add( entity( session, tuple, loader ) );
    }
    return results;
  }
View Full Code Here

    return entities.get( 0 );
  }

  private OgmLoader createLoader(SessionImplementor session, Class<?> entityClass) {
    OgmEntityPersister persister = (OgmEntityPersister) ( session.getFactory() ).getEntityPersister( entityClass.getName() );
    OgmLoader loader = new OgmLoader( new OgmEntityPersister[] { persister } );
    return loader;
  }
View Full Code Here

    return entities.get( 0 );
  }

  private OgmLoader createLoader(SessionImplementor session, Class<?> entityClass) {
    OgmEntityPersister persister = (OgmEntityPersister) ( session.getFactory() ).getEntityPersister( entityClass.getName() );
    OgmLoader loader = new OgmLoader( new OgmEntityPersister[] { persister } );
    return loader;
  }
View Full Code Here

  @Override
  protected UniqueEntityLoader createEntityLoader(LockMode lockMode, LoadQueryInfluencers loadQueryInfluencers)
      throws MappingException {
    //FIXME add support to lock mode and loadQueryInfluencers
    return new OgmLoader( new OgmEntityPersister[] { this } );
  }
View Full Code Here

  @Override
  protected UniqueEntityLoader createEntityLoader(LockOptions lockOptions, LoadQueryInfluencers loadQueryInfluencers)
      throws MappingException {
    //FIXME add support to lock options and loadQueryInfluencers
    return new OgmLoader( new OgmEntityPersister[] { this } );
  }
View Full Code Here

    Map<String, Object> entityTuple = extractEntityTuple( sessions, key );
    final Tuple tuple = new Tuple( new MapTupleSnapshot( entityTuple ) );

    EntityPersister persister = ( (SessionFactoryImplementor) session.getSessionFactory() )
        .getEntityPersister( Feeling.class.getName() );
    OgmLoader loader = new OgmLoader( new OgmEntityPersister[] { (OgmEntityPersister) persister } );
    OgmLoadingContext ogmLoadingContext = new OgmLoadingContext();
    List<Tuple> tuples = new ArrayList<Tuple>();
    tuples.add( tuple );
    ogmLoadingContext.setTuples( tuples );
    List<Object> entities = loader.loadEntities( (SessionImplementor) session, LockOptions.NONE, ogmLoadingContext );
    assertThat( entities.size() ).isEqualTo( 1 );
    assertThat( ( (Feeling) entities.get( 0 ) ).getName() ).isEqualTo( "Moody" );
    transaction.commit();
    session.close();
  }
View Full Code Here

  @Override
  protected UniqueEntityLoader createEntityLoader(LockMode lockMode, LoadQueryInfluencers loadQueryInfluencers)
      throws MappingException {
    //FIXME add support to lock mode and loadQueryInfluencers
    return new OgmLoader( new OgmEntityPersister[] { this } );
  }
View Full Code Here

  @Override
  protected UniqueEntityLoader createEntityLoader(LockOptions lockOptions, LoadQueryInfluencers loadQueryInfluencers)
      throws MappingException {
    //FIXME add support to lock options and loadQueryInfluencers
    return new OgmLoader( new OgmEntityPersister[] { this } );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.ogm.loader.impl.OgmLoader

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.