com.liferay.portal.kernel.dao.orm.Query类的使用及代码示例

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

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

Query介绍

[英][View Source](https://www.tabnine.com/code/java/classes/com.liferay.portal.kernel.dao.orm.Query#)
[中][View Source](https://www.tabnine.com/code/java/classes/com.liferay.portal.kernel.dao.orm.Query#)

代码示例

代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel

return query.list(unmodifiable);
  query.setMaxResults(end - start);
  query.setFirstResult(start);
  return query.list(unmodifiable);
ScrollableResults sr = query.scroll();

代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel

public void add(boolean value) {
  _query.setBoolean(_pos++, value);
}

代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel

public void add(double value) {
  _query.setDouble(_pos++, value);
}

代码示例来源:origin: com.liferay/com.liferay.dynamic.data.mapping.service

q.setFirstResult(0);
q.setMaxResults(2);
List<DDMStructure> list = q.list();

代码示例来源:origin: liferay/liferay-ide

for (Club club : (List<Club>)q.list()) {
  map.put(club.getPrimaryKeyObj(), club);

代码示例来源:origin: com.liferay/com.liferay.dynamic.data.mapping.service

/**
 * Returns the number of ddm structure links.
 *
 * @return the number of ddm structure links
 */
@Override
public int countAll() {
  Long count = (Long)finderCache.getResult(_finderPathCountAll,
      FINDER_ARGS_EMPTY, this);
  if (count == null) {
    Session session = null;
    try {
      session = openSession();
      Query q = session.createQuery(_SQL_COUNT_DDMSTRUCTURELINK);
      count = (Long)q.uniqueResult();
      finderCache.putResult(_finderPathCountAll, FINDER_ARGS_EMPTY,
        count);
    }
    catch (Exception e) {
      finderCache.removeResult(_finderPathCountAll, FINDER_ARGS_EMPTY);
      throw processException(e);
    }
    finally {
      closeSession(session);
    }
  }
  return count.intValue();
}

代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel

public void add(float value) {
  _query.setFloat(_pos++, value);
}

代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel

public void add(int value) {
  _query.setInteger(_pos++, value);
}

代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel

public void add(long value) {
  _query.setLong(_pos++, value);
}

代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel

ScrollableResults sr = query.scroll();

代码示例来源:origin: com.liferay/com.liferay.journal.service

q.setFirstResult(0);
q.setMaxResults(2);
List<JournalArticle> list = q.list();

代码示例来源:origin: liferay/liferay-ide

for (RosterMember rosterMember : (List<RosterMember>)q.list()) {
  map.put(rosterMember.getPrimaryKeyObj(), rosterMember);

代码示例来源:origin: com.liferay/com.liferay.journal.service

/**
 * Returns the number of journal folders.
 *
 * @return the number of journal folders
 */
@Override
public int countAll() {
  Long count = (Long)finderCache.getResult(_finderPathCountAll,
      FINDER_ARGS_EMPTY, this);
  if (count == null) {
    Session session = null;
    try {
      session = openSession();
      Query q = session.createQuery(_SQL_COUNT_JOURNALFOLDER);
      count = (Long)q.uniqueResult();
      finderCache.putResult(_finderPathCountAll, FINDER_ARGS_EMPTY,
        count);
    }
    catch (Exception e) {
      finderCache.removeResult(_finderPathCountAll, FINDER_ARGS_EMPTY);
      throw processException(e);
    }
    finally {
      closeSession(session);
    }
  }
  return count.intValue();
}

代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel

public void add(Float value) {
  if (value != null) {
    _query.setFloat(_pos++, value.intValue());
  }
  else {
    _addNull();
  }
}

代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel

public void add(Integer value) {
  if (value != null) {
    _query.setInteger(_pos++, value.intValue());
  }
  else {
    _addNull();
  }
}

代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel

public void add(Long value) {
  if (value != null) {
    _query.setLong(_pos++, value.longValue());
  }
  else {
    _addNull();
  }
}

代码示例来源:origin: com.liferay.portal/portal-kernel

public static List<?> randomList(
  Query query, Dialect dialect, int total, int num,
  boolean unmodifiable) {
  if ((total == 0) || (num == 0)) {
    return new ArrayList<Object>();
  }
  if (num >= total) {
    return list(query, dialect, ALL_POS, ALL_POS, true);
  }
  int[] scrollIds = Randomizer.getInstance().nextInt(total, num);
  List<Object> list = new ArrayList<Object>();
  ScrollableResults sr = query.scroll();
  for (int i = 0; i < scrollIds.length; i++) {
    if (sr.scroll(scrollIds[i])) {
      Object obj = sr.get(0);
      list.add(obj);
      sr.first();
    }
  }
  if (unmodifiable) {
    return new UnmodifiableList(list);
  }
  else {
    return list;
  }
}

代码示例来源:origin: com.liferay/com.liferay.journal.service

q.setFirstResult(0);
q.setMaxResults(2);
List<JournalArticle> list = q.list();

代码示例来源:origin: com.liferay/com.liferay.dynamic.data.mapping.service

for (DDMFormInstance ddmFormInstance : (List<DDMFormInstance>)q.list()) {
  map.put(ddmFormInstance.getPrimaryKeyObj(), ddmFormInstance);

代码示例来源:origin: com.liferay.portal/portal-kernel

return query.list(unmodifiable);
  query.setMaxResults(end - start);
  query.setFirstResult(start);
  return query.list(unmodifiable);
  ScrollableResults sr = query.scroll();

相关文章