org.datanucleus.store.query.Query类的使用及代码示例

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

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

Query介绍

暂无

代码示例

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

internalQuery.addExtension(Query.EXTENSION_FLUSH_BEFORE_EXECUTION, Boolean.TRUE);
internalQuery.setIgnoreCache(ignoreCache);
if (extensions != null)
  internalQuery.setExtensions(extensions);
  internalQuery.setFetchPlan(fetchPlan.getInternalFetchPlan());
  internalQuery.setSerializeRead(serializeRead);
  internalQuery.setDatastoreReadTimeoutMillis(datastoreReadTimeout);
  internalQuery.setDatastoreWriteTimeoutMillis(datastoreWriteTimeout);
  internalQuery.setSubclasses(false);
  internalQuery.setType(Query.QueryType.SELECT);
  if (resultDistinct != null)
    internalQuery.setResultDistinct(resultDistinct.booleanValue());
  internalQuery.setResultClass(resultClass);
  internalQuery.setUnique(unique);
  if (candidates != null)
    internalQuery.setCandidates(candidates);
  internalQuery.setType(Query.QueryType.BULK_UPDATE);

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

/**
 * Accessor for the ignore cache setting
 * @return Ignore cache
 */
public boolean getIgnoreCache()
{
  assertIsOpen();
  return query.getIgnoreCache();
}

代码示例来源:origin: forcedotcom/java-sdk

/**
 * See if there is a limit set and if we can use SOQL to execute the query.
 * 
 * @param query Query
 * @return the limit type of Soql, Java, or None
 */
public static LimitType getLimitType(Query query) {
  if (query.getRangeFromIncl() > 0 || (query.getRangeToExcl() > 0 && query.getRangeToExcl() < Long.MAX_VALUE)) {
    if (query.getRangeFromIncl() == 0) return LimitType.Soql;
    return LimitType.Java;
  }
  return LimitType.None;
}

代码示例来源:origin: com.blazebit/blaze-persistence-integration-datanucleus-5.1

@Override
public String getSql(EntityManager em, Query query) {
  org.datanucleus.store.query.Query<?> dnQuery = query.unwrap(org.datanucleus.store.query.Query.class);
  dnQuery.compile();
  return (String) dnQuery.getNativeQuery();
}

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

/**
 * Convenience method to return if the specified query should use an "UPDATE" lock on returned objects.
 * First checks whether serializeRead is set on the query and, if not, falls back to the setting for the class.
 * @param query The query
 * @return Whether to use an "UPDATE" lock
 */
public static boolean useUpdateLockForQuery(Query query)
{
  if (query.getSerializeRead() != null)
  {
    if (!query.getExecutionContext().getTransaction().isActive())
    {
      // Only applies in a transaction
      return false;
    }
    // Query value takes top priority
    return query.getSerializeRead();
  }
  // Fallback to transaction or class itself
  return query.getExecutionContext().getSerializeReadForClass(query.getCandidateClassName());
}

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

ExecutionContext ec = query.getExecutionContext();
ClassLoaderResolver clr = ec.getClassLoaderResolver();
RDBMSStoreManager storeMgr = (RDBMSStoreManager) query.getStoreManager();
Store backingStore = storeMgr.getBackingStoreForField(clr, mmd, null);
    datastoreCompilation.getResultDefinitionForClass(), ec, query.getCandidateClass(), query.isSubclasses(), query.getResult(), null, null, null);
  Set<String> options = new HashSet<>();
  if (mapperOptions != null)
  QueryToSQLMapper sqlMapper = new QueryToSQLMapper(existsStmt, query.getCompilation(), parameters,
    null, null, candidateCmd, query.isSubclasses(), query.getFetchPlan(), ec, query.getParsedImports(), options, query.getExtensions());
  sqlMapper.compile();
    datastoreCompilation.getResultDefinitionForClass(), ec, query.getCandidateClass(), query.isSubclasses(), query.getResult(), null, null, null);
  Set<String> options = new HashSet<>();
  if (mapperOptions != null)
  QueryToSQLMapper sqlMapper = new QueryToSQLMapper(existsStmt, query.getCompilation(), parameters,
    null, null, candidateCmd, query.isSubclasses(), query.getFetchPlan(), ec, query.getParsedImports(), options, query.getExtensions());
  sqlMapper.compile();

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

Integer timeout = query.getDatastoreReadTimeoutMillis();
  if (timeout != null && timeout > 0)
if (query.getFetchPlan().getFetchSize() > 0)
  fetchSize = query.getFetchPlan().getFetchSize();
if (((RDBMSStoreManager)query.getStoreManager()).getDatastoreAdapter().supportsQueryFetchSize(fetchSize))
Configuration conf = query.getExecutionContext().getNucleusContext().getConfiguration();
String fetchDir = conf.getStringProperty(RDBMSPropertyNames.PROPERTY_RDBMS_QUERY_FETCH_DIRECTION);
Object fetchDirExt = query.getExtension(RDBMSPropertyNames.PROPERTY_RDBMS_QUERY_FETCH_DIRECTION);
if (fetchDirExt != null)
long toExclNo = query.getRangeToExcl();
if (toExclNo != 0 && toExclNo != Long.MAX_VALUE)

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

if (query.getCandidateClassName() != null)
  queryName = query.getCandidateClassName() + "_" + name;
qmd.setLanguage(language);
qmd.setQuery(query.toString());
qmd.setResultClass(query.getResultClassName());
qmd.setUnique(query.isUnique());
Map<String, Object> queryExts = query.getExtensions();
if (queryExts != null && !queryExts.isEmpty())
query.getExecutionContext().getMetaDataManager().registerNamedQuery(qmd);

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

if (memberValues != null)
  ObjectProvider op = query.getExecutionContext().findObjectProvider(nextElement);
  Iterator<Map.Entry<Integer, Object>> memberValIter = memberValues.entrySet().iterator();
  while (memberValIter.hasNext())
  int maxElements = (int)(query.getRangeToExcl() - query.getRangeFromIncl());
  if (resultObjs.size() == maxElements)

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

rangeFrom = (query.getRangeFromIncl() > 0 ? query.getRangeFromIncl() : null);
    rangeTo = (query.getRangeToExcl() != Long.MAX_VALUE ? query.getRangeToExcl() : null);
    if (rangeFrom != null || rangeTo != null)
  query.isSubclasses(), filterText, (resultComplete ? resultText : null), orderText, rangeFrom, rangeTo);
neo4jCompilation.setCypherText(cypherText);

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

/**
 * Set the result class for the results.
 * Setting this will unset the resultMetaData.
 * @param result_cls The result class
 */
public void setResultClass(Class result_cls)
{
  super.setResultClass(result_cls);
  this.resultMetaData = null;
}

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

ExecutionContext ec = q.getExecutionContext();
StoreManager storeMgr = ec.getStoreManager();
ClassLoaderResolver clr = ec.getClassLoaderResolver();
List<AbstractClassMetaData> cmds = MetaDataUtils.getMetaDataForCandidates(q.getCandidateClass(), q.isSubclasses(), ec);
  int[] fpMembers = q.getFetchPlan().getFetchPlanForClass(rootCmd).getMemberNumbers();
  BasicDBObject fieldsSelection = new BasicDBObject();
  if (fpMembers != null && fpMembers.length > 0)

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

public LazyLoadQueryResult(Query q, Result result, String cypherResult)
  this.candidateAliasName = query.getCompilation().getCandidateAlias();
  this.ec = q.getExecutionContext();
  this.cmd = ec.getMetaDataManager().getMetaDataForClass(query.getCandidateClass(), ec.getClassLoaderResolver());
  this.result = result;
  this.cypherResults = (cypherResult != null ? cypherResult.split(",") : null);
  String cacheType = query.getStringExtensionProperty("cacheType", "strong");
  if (cacheType != null)

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

/**
 * Method to add a vendor extension to the query.
 * If the hint name is not recognized, it is silently ignored.
 * @param hintName Name of the "hint"
 * @param value Value for the "hint"
 * @return the same query instance
 * @throws IllegalArgumentException if the second argument is not valid for the implementation
 */
public JPAQuery<X> setHint(String hintName, Object value)
{
  // Just treat a "hint" as an "extension".
  query.addExtension(hintName, value);
  return this;
}

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

private Object getResultFromMapRow(Map<String, Object> map)
{
  Object result = null;
  if (cypherResults == null || (candidateAliasName != null && cypherResults[0].equals(candidateAliasName)))
  {
    // Candidate result
    PropertyContainer node = (PropertyContainer) map.get(candidateAliasName);
    AbstractClassMetaData propObjCmd = Neo4jUtils.getClassMetaDataForPropertyContainer(node, query.getExecutionContext(), cmd);
    result = Neo4jUtils.getObjectForPropertyContainer(node, propObjCmd, query.getExecutionContext(), query.getIgnoreCache());
  }
  else
  {
    // Result clause specified, so extract into Object or Object[]
    if (cypherResults.length == 1)
    {
      result = map.get(cypherResults[0]);
    }
    else
    {
      result = new Object[cypherResults.length];
      for (int i=0;i<cypherResults.length;i++)
      {
        Array.set(result, i, map.get(cypherResults[i]));
      }
    }
  }
  return result;
}

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

if (query.getType() != org.datanucleus.store.query.Query.SELECT)
  query.setUnique(true);
    query.setSerializeRead(Boolean.TRUE);
  return (X)query.executeWithMap(null); // Params defined using setParameter() earlier

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

jpoxQuery.setResultClass(resultClass);
  return new JPAQuery(this, jpoxQuery, qmd.getLanguage());
jpoxQuery.setResultMetaData(qrmd);
return new JPAQuery(this, jpoxQuery, qmd.getLanguage());

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

@Override
public <R> R executeResultUnique(Class<R> resultCls)
{
  assertIsOpen();
  query.setUnique(true);
  if (resultCls == null)
  {
    throw new JDOUserException("Result Class must be specified");
  }
  this.query.setResultClass(resultCls);
  return (R) executeInternal();
}

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

if (query.getType() != org.datanucleus.store.query.Query.SELECT)
    query.setSerializeRead(Boolean.TRUE);
  return (List)query.executeWithMap(null); // Params defined using setParameter() earlier

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

if (query.getType() != org.datanucleus.store.query.Query.SELECT)
  query.setUnique(true);
  return query.executeWithMap(null); // Params defined using setParameter() earlier

相关文章