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

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

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

Query.getSerializeRead介绍

暂无

代码示例

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

/**
 * Accessor for whether to serialise any read objects in this query.
 * @return The setting for whether to serialise any read objects
 */
public Boolean getSerializeRead()
{
  assertIsOpen();
  return query.getSerializeRead();
}

代码示例来源: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());
}

相关文章