org.datanucleus.store.query.Query.setRange()方法的使用及代码示例

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

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

Query.setRange介绍

暂无

代码示例

代码示例来源:origin: org.datanucleus/datanucleus-jpa

/**
 * Method to set the results to start from a particular position.
 * @param startPosition position of first result numbered from 0
 * @return The query
 */
public JPAQuery<X> setFirstResult(int startPosition)
{
  if (startPosition < 0)
  {
    throw new IllegalArgumentException(LOCALISER.msg("Query.StartPositionInvalid"));
  }
  this.startPosition = startPosition;
  if (this.maxResults == Long.MAX_VALUE)
  {
    query.setRange(this.startPosition, Long.MAX_VALUE);
  }
  else
  {
    query.setRange(this.startPosition, this.startPosition+this.maxResults);
  }
  return this;
}

代码示例来源:origin: org.datanucleus/datanucleus-jpa

/**
 * Method to set the max number of results to return.
 * @param max Number of results max
 * @return The query
 */
public JPAQuery<X> setMaxResults(int max)
{
  if (max < 0)
  {
    throw new IllegalArgumentException(LOCALISER.msg("Query.MaxResultsInvalid"));
  }
  this.maxResults = max;
  query.setRange(startPosition, startPosition+max);
  return this;
}

代码示例来源:origin: org.datanucleus/datanucleus-java5

/**
 * Method to set the max number of results to return.
 * @param max Number of results max
 * @return The query
 */
public Query setMaxResults(int max)
{
  if (max < 0)
  {
    throw new IllegalArgumentException(LOCALISER.msg("Query.MaxResultsInvalid"));
  }
  this.maxResults = max;
  query.setRange(startPosition, startPosition+max);
  return this;
}

代码示例来源:origin: org.datanucleus/datanucleus-java5

/**
 * Method to set the results to start from a particular position.
 * @param startPosition position of first result numbered from 0
 * @return The query
 */
public Query setFirstResult(int startPosition)
{
  if (startPosition < 0)
  {
    throw new IllegalArgumentException(LOCALISER.msg("Query.StartPositionInvalid"));
  }
  this.startPosition = startPosition;
  query.setRange(this.startPosition, this.maxResults);
  return this;
}

代码示例来源:origin: org.datanucleus/datanucleus-api-jdo

/**
 * Set the range for the query.
 * @param range The range specification
 */
public void setRange(String range)
{
  assertIsOpen();
  try
  {
    query.setRange(range);
  }
  catch (NucleusException jpe)
  {
    throw NucleusJDOHelper.getJDOExceptionForNucleusException(jpe);
  }
}

代码示例来源:origin: org.datanucleus/datanucleus-api-jdo

/**
 * Set the range for the query.
 * @param fromIncl From range inclusive
 * @param toExcl To range exclusive
 */
public void setRange(long fromIncl, long toExcl)
{
  assertIsOpen();
  try
  {
    query.setRange(fromIncl, toExcl);
  }
  catch (NucleusException jpe)
  {
    throw NucleusJDOHelper.getJDOExceptionForNucleusException(jpe);
  }
}

相关文章