Package org.hibernate.ogm.query

Examples of org.hibernate.ogm.query.NoSQLQuery


    tx.commit();
    session.close();
  }

  private void assertCountQueryResult(OgmSession session, String queryString, long expectedCount) {
    NoSQLQuery query = session.createNativeQuery( queryString );
    query.addScalar( "n" );
    long actualCount = (Long) query.list().iterator().next();
    assertThat( actualCount ).describedAs( "Count query didn't yield expected result" ).isEqualTo( expectedCount );
  }
View Full Code Here


    tx.commit();
    session.close();
  }

  private void assertCountQueryResult(OgmSession session, String queryString, long expectedCount) {
    NoSQLQuery query = session.createNativeQuery( queryString );
    query.addScalar( "n" );
    long actualCount = (Long) query.list().iterator().next();
    assertThat( actualCount ).describedAs( "Count query didn't yield expected result" ).isEqualTo( expectedCount );
  }
View Full Code Here

    String tableName = ( (OgmEntityPersister) ( sessionImplementor
        .getFactory() )
        .getEntityPersister( result.getEntityType().getName() ) )
        .getTableName();

    NoSQLQuery query = new NoSQLQueryImpl(
        new MongoDBQueryDescriptor(
            tableName,
            Operation.FIND, //so far only SELECT is supported
            result.getQuery(),
            result.getProjection(),
            result.getOrderBy()
        ),
        sessionImplementor,
        new ParameterMetadata( null, null )
    );

    // Register the result types of the query; Currently either a number of scalar values or an entity return
    // are supported only; JP-QL would actually a combination of both, though (see OGM-514)
    if ( result.getProjection() != null ) {
      for ( String field : result.getProjection().keySet() ) {
        query.addScalar( field );
      }
    }
    else {
      query.addEntity( result.getEntityType() );
    }

    return query;
  }
View Full Code Here

    String tableName = ( (OgmEntityPersister) ( sessionImplementor
        .getFactory() )
        .getEntityPersister( result.getEntityType().getName() ) )
        .getTableName();

    NoSQLQuery query = new DBObjectQuery(
        tableName,
        result.getQuery(),
        result.getProjection(),
        result.getOrderBy(),
        sessionImplementor,
        new ParameterMetadata( null, null )
    );

    // Register the result types of the query; Currently either a number of scalar values or an entity return
    // are supported only; JP-QL would actually a combination of both, though (see OGM-514)
    if ( result.getProjection() != null ) {
      for ( String field : result.getProjection().keySet() ) {
        query.addScalar( field );
      }
    }
    else {
      query.addEntity( result.getEntityType() );
    }

    return query;
  }
View Full Code Here

    QueryParser queryParser = new QueryParser();
    Neo4jProcessingChain processingChain = createProcessingChain( session, unwrap( namedParameters ) );
    Neo4jQueryParsingResult result = queryParser.parseQuery( queryString, processingChain );

    log.createdQuery( queryString, result );
    NoSQLQuery query = nosqlQuery( session, result );
    return query;
  }
View Full Code Here

    NoSQLQuery query = nosqlQuery( session, result );
    return query;
  }

  private NoSQLQuery nosqlQuery(OgmSession session, Neo4jQueryParsingResult result) {
    NoSQLQuery query = new NoSQLQueryImpl( result.getQuery(), (SessionImplementor) session, new ParameterMetadata( null, null ) );
    // Register the result types of the query; Currently either a number of scalar values or an entity return
    // are supported only; JP-QL would actually a combination of both, though (see OGM-514)
    if ( hasProjections( result ) ) {
      for ( String field : result.getProjections() ) {
        query.addScalar( field );
      }
    }
    else {
      query.addEntity( result.getEntityType() );
    }
    return query;
  }
View Full Code Here

TOP

Related Classes of org.hibernate.ogm.query.NoSQLQuery

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.