com.impetus.kundera.query.Query.setFetchSize()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中com.impetus.kundera.query.Query.setFetchSize方法的一些代码示例,展示了Query.setFetchSize的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.setFetchSize方法的具体详情如下:
包路径:com.impetus.kundera.query.Query
类名称:Query
方法名:setFetchSize

Query.setFetchSize介绍

[英]To set fetch size for query.
[中]设置查询的获取大小。

代码示例

代码示例来源:origin: Impetus/Kundera

@Override
public void setFetchSize(Integer fetchsize)
{
  ((com.impetus.kundera.query.Query)query).setFetchSize(fetchsize);
}

代码示例来源:origin: Impetus/Kundera

@Test
public void chunkScrollTest() throws Exception
{
  //without where clause
  int chunkSize = 50;
  Query query = (Query) em.createQuery("Select p from PersonHBase p", PersonHBase.class);
  query.setFetchSize(1000);
  Iterator<PersonHBase> iter = query.iterate();
  IResultIterator<PersonHBase> iIter = (IResultIterator<PersonHBase>) iter;
  assertScrolling(chunkSize, iIter);
  
  //with where clause
  String name = "vivek";
  query = (Query) em.createQuery("Select p from PersonHBase p where p.personName = '"+name+"'", PersonHBase.class);
  query.setFetchSize(1000);
  iter = query.iterate();
  iIter = (IResultIterator<PersonHBase>) iter;
  assertScrolling(chunkSize, iIter);
}

代码示例来源:origin: Impetus/Kundera

queryObject.setFetchSize(1);

代码示例来源:origin: Impetus/Kundera

private void assertOnFetch(Query query, Integer fetchSize, int available)
{
  query.setFetchSize(fetchSize);
  int counter=0;
  Iterator<CassandraPrimeUser> iter = query.iterate();
  while (iter.hasNext())
  {
    Assert.assertNotNull(iter.next());
    counter++;
  }
  Assert.assertEquals(counter, fetchSize == null || available < fetchSize?available:fetchSize);
  try
  {
    iter.next();
    Assert.fail();
  }
  catch (NoSuchElementException nsex)
  {
    Assert.assertNotNull(nsex.getMessage());
  }
}

代码示例来源:origin: Impetus/Kundera

private void assertOnFetch(Query query, Integer fetchSize, int available)
{
  query.setFetchSize(fetchSize);
  int counter = 0;
  Iterator<PersonHBase> iter = query.iterate();
  while (iter.hasNext())
  {
    Assert.assertNotNull(iter.next());
    counter++;
  }
  Assert.assertEquals(counter, fetchSize == null || available < fetchSize ? available : fetchSize);
  try
  {
    iter.next();
    Assert.fail();
  }
  catch (NoSuchElementException nsex)
  {
    Assert.assertNotNull(nsex.getMessage());
  }
}

代码示例来源:origin: Impetus/Kundera

Assert.assertEquals(FlushModeType.AUTO, FlushModeType.AUTO);
((Query) query).setFetchSize(100);
Assert.assertNotNull(((Query) query).getFetchSize());
Assert.assertEquals(100, ((Query) query).getFetchSize().intValue());

代码示例来源:origin: Impetus/Kundera

private void assertOnFetch(Query query, Integer fetchSize, int available)
{
  query.setFetchSize(fetchSize);
  int counter = 0;
  Iterator<PersonRDBMS> iter = query.iterate();
  while (iter.hasNext())
  {
    Assert.assertNotNull(iter.next());
    counter++;
  }
  Assert.assertEquals(counter, fetchSize == null || available < fetchSize ? available : fetchSize);
  try
  {
    iter.next();
    Assert.fail();
  }
  catch (NoSuchElementException nsex)
  {
    Assert.assertNotNull(nsex.getMessage());
  }
}

代码示例来源:origin: Impetus/Kundera

private void assertOnFetch(Query query, Integer fetchSize, int available)
{
  query.setFetchSize(fetchSize);
  int counter = 0;
  Iterator<PersonMongo> iter = query.iterate();
  while (iter.hasNext())
  {
    Assert.assertNotNull(iter.next());
    counter++;
  }
  Assert.assertEquals(counter, fetchSize == null || available < fetchSize ? available : fetchSize);
  try
  {
    iter.next();
    Assert.fail();
  }
  catch (NoSuchElementException nsex)
  {
    Assert.assertNotNull(nsex.getMessage());
  }
}

代码示例来源:origin: Impetus/Kundera

private void assertOnFetch(Query query, Integer fetchSize, int available)
{
  query.setFetchSize(fetchSize);
  int counter=0;
  Iterator<PrimeUser> iter = query.iterate();
  while (iter.hasNext())
  {
    Assert.assertNotNull(iter.next());
    counter++;
  }
  Assert.assertEquals(counter, fetchSize != null && fetchSize == 0 ? 0:available);
  try
  {
    iter.next();
    Assert.fail();
  }
  catch (NoSuchElementException nsex)
  {
    Assert.assertNotNull(nsex.getMessage());
  }
}

代码示例来源:origin: Impetus/Kundera

private void assertOnFetch(Query query, Integer fetchSize, int expectedCount)
{
  query.setFetchSize(fetchSize);
  int counter = 0;
  Iterator<PersonCouchDB> iter = query.iterate();
  while (iter.hasNext())
  {
    Assert.assertNotNull(iter.next());
    counter++;
  }
  Assert.assertEquals(counter, fetchSize == null || expectedCount < fetchSize ? expectedCount : fetchSize);
  try
  {
    iter.next();
    Assert.fail();
  }
  catch (NoSuchElementException nsex)
  {
    Assert.assertNotNull(nsex.getMessage());
  }
}

代码示例来源:origin: Impetus/Kundera

private void assertOnFetch(Query query, Integer fetchSize, int available)
{
  query.setFetchSize(fetchSize);
  int counter=0;
  try
  {
  Iterator<PersonCassandra> iter = query.iterate();
  while (iter.hasNext())
  {
    Assert.assertNotNull(iter.next());
    counter++;
  }
  Assert.assertEquals(counter, fetchSize != null && fetchSize == 0 ? 0:available);
  try
  {
    iter.next();
    Assert.fail();
  }
  catch (NoSuchElementException nsex)
  {
    Assert.assertNotNull(nsex.getMessage());
  }
  }catch(UnsupportedOperationException e)
  { 
    Assert.assertEquals("Iteration not supported over native queries",e.getMessage());
  }
  
}

代码示例来源:origin: Impetus/Kundera

private void assertOnFetch(Query query, Integer fetchSize, int available)
{
  query.setFetchSize(fetchSize);
  int counter=0;
  try
  {
  Iterator<PersonCassandra> iter = query.iterate();
  while (iter.hasNext())
  {
    Assert.assertNotNull(iter.next());
    counter++;
  }
  Assert.assertEquals(counter, fetchSize == null || available < fetchSize?available:fetchSize);
  try
  {
    iter.next();
    Assert.fail();
  }
  catch (NoSuchElementException nsex)
  {
    Assert.assertNotNull(nsex.getMessage());
  }
  }catch(UnsupportedOperationException e)
  { 
    Assert.assertEquals("Iteration not supported over native queries",e.getMessage());
  }
  
}

代码示例来源:origin: Impetus/Kundera

query.setFetchSize(fetchSize);
int counter = 0;
Iterator<Book> iter = query.iterate();

代码示例来源:origin: Impetus/Kundera

@Test
public void testIteratorWithOneFilter()
{
  Map<String, Client> clients = (Map<String, Client>) em.getDelegate();
  HBaseClient client = (HBaseClient) clients.get("hbaseTest");
  Filter filter = new PrefixFilter(Bytes.toBytes("100" + "_"));
  client.setFilter(new KeyOnlyFilter());
  client.addFilter("city_similarity", filter);
  String query2 = "select u from CitySimilarity u";
  com.impetus.kundera.query.Query queryObject = (com.impetus.kundera.query.Query) em
      .createQuery(query2);
  queryObject.setFetchSize(10);
  Iterator<CitySimilarity> resultIterator = queryObject.iterate();
  CitySimilarity cityS = null;
  int counter = 0;
  while (resultIterator.hasNext())
  {
    counter++;
    cityS = resultIterator.next();
    Assert.assertNotNull(cityS);
    Assert.assertNotNull(cityS.getId());
    Assert.assertNull(cityS.getBookInfo());
  }
  Assert.assertEquals(2, counter);
}

代码示例来源:origin: Impetus/Kundera

@Test
public void testIterator()
{
  String query2 = "select u from CitySimilarity u";
  com.impetus.kundera.query.Query queryObject = (com.impetus.kundera.query.Query) em
      .createQuery(query2);
  queryObject.setFetchSize(10);
  Iterator<CitySimilarity> resultIterator = queryObject.iterate();
  CitySimilarity cityS = null;
  int counter = 0;
  while (resultIterator.hasNext())
  {
    counter++;
    cityS = resultIterator.next();
    Assert.assertNotNull(cityS);
    Assert.assertNotNull(cityS.getId());
    Assert.assertNotNull(cityS.getBookInfo());
    Assert.assertNotNull(cityS.getBookInfo().getBookId());
  }
  Assert.assertEquals(2, counter);
}

代码示例来源:origin: Impetus/Kundera

com.impetus.kundera.query.Query q = (com.impetus.kundera.query.Query) em
    .createQuery(query);
q.setFetchSize(1);
Iterator<UserAndPassword> results = q.iterate();
while (results.hasNext())
q.setFetchSize(1);
results = q.iterate();
while (results.hasNext())

代码示例来源:origin: Impetus/Kundera

com.impetus.kundera.query.Query q = (com.impetus.kundera.query.Query) em
    .createQuery(query);
q.setFetchSize(1);
Iterator<UserAndPassword> results = q.iterate();
while (results.hasNext())
query = "select u from UserAndPassword u where u.userName=KK6";
q = (com.impetus.kundera.query.Query) em.createQuery(query);
q.setFetchSize(1);
results = q.iterate();
while (results.hasNext())

代码示例来源:origin: Impetus/Kundera

.createQuery("SELECT e FROM DSEntityWithMultiplePartitionKey e");
query.setFetchSize(2);

代码示例来源:origin: Impetus/Kundera

.createQuery("SELECT e FROM EntityWithMultiplePartitionKey e");
query.setFetchSize(1);

代码示例来源:origin: Impetus/Kundera

.createQuery(query2);
queryObject.setFetchSize(10);

相关文章