當前位置: 首頁>>代碼示例>>Java>>正文


Java SqlQuery類代碼示例

本文整理匯總了Java中io.ebean.SqlQuery的典型用法代碼示例。如果您正苦於以下問題:Java SqlQuery類的具體用法?Java SqlQuery怎麽用?Java SqlQuery使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SqlQuery類屬於io.ebean包,在下文中一共展示了SqlQuery類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doExecute

import io.ebean.SqlQuery; //導入依賴的package包/類
@Override
@SuppressWarnings("unchecked")
protected Object doExecute(final AbstractEbeanQuery repositoryQuery, final Object[] values) {
  ParameterAccessor accessor = new ParametersParameterAccessor(parameters, values);
  Object createQuery = repositoryQuery.createQuery(values);

  if (createQuery instanceof Query) {
    Query ormQuery = (Query) createQuery;
    PagedList pagedList = ormQuery.findPagedList();
    return PageableExecutionUtils.getPage(pagedList.getList(), accessor.getPageable(), () -> pagedList.getTotalCount());
  } else if (createQuery instanceof SqlQuery) {
    SqlQuery sqlQuery = (SqlQuery) createQuery;
    // TODO page
    return sqlQuery.findList();
  } else {
    throw new InvalidEbeanQueryMethodException("query must be Query or SqlQuery");
  }
}
 
開發者ID:hexagonframework,項目名稱:spring-data-ebean,代碼行數:19,代碼來源:AbstractEbeanQueryExecution.java

示例2: bindAndPrepare

import io.ebean.SqlQuery; //導入依賴的package包/類
private Object bindAndPrepare(Object query, Parameters<?, ?> parameters) {

        Object result = bind(query);

        if (!parameters.hasPageableParameter()) {
            return result;
        }
        if (query instanceof Query) {
            Query ormQuery = (Query) query;
            ormQuery.setFirstRow((int) getPageable().getOffset());
            ormQuery.setMaxRows(getPageable().getPageSize());
        } else if (query instanceof SqlQuery) {
            SqlQuery sqlQuery = (SqlQuery) query;
            sqlQuery.setFirstRow((int) getPageable().getOffset());
            sqlQuery.setMaxRows(getPageable().getPageSize());
        }

        return result;
    }
 
開發者ID:hexagonframework,項目名稱:spring-data-ebean,代碼行數:20,代碼來源:ParameterBinder.java

示例3: obtainEntriesReleaseLock

import io.ebean.SqlQuery; //導入依賴的package包/類
private List<SqlRow> obtainEntriesReleaseLock() {
  try {

    // read a batch of queue entries
    Transaction transaction = server.createTransaction();
    try {
      SqlQuery sqlQuery = server.createSqlQuery(sqlObtainEntries);


      List<SqlRow> rows = server.findList(sqlQuery, transaction);

      SqlUpdate sqlUpdate = server.createSqlUpdate(markProcessingSql);

      transaction.setBatchSize(100);
      // update the entries marking them as processing
      for (int i = 0; i < rows.size(); i++) {
        SqlRow row = rows.get(i);
        markEntryAsProcessing(row, sqlUpdate, transaction);
      }

      // return the entries
      transaction.commit();

      return rows;

    } finally {
      transaction.end();
    }

  } finally {
    releaseClusterWideLock();
  }

}
 
開發者ID:ebean-orm,項目名稱:ebean-elastic,代碼行數:35,代碼來源:BaseIndexQueueReader.java

示例4: createSqlQuery

import io.ebean.SqlQuery; //導入依賴的package包/類
public SqlQuery createSqlQuery(String sql) {
  return delegate.createSqlQuery(sql);
}
 
開發者ID:ebean-orm,項目名稱:ebean-mocker,代碼行數:4,代碼來源:DelegateQuery.java

示例5: findList

import io.ebean.SqlQuery; //導入依賴的package包/類
@Override
public List<SqlRow> findList(SqlQuery query, Transaction transaction) {
  return delegate.findList(query, transaction);
}
 
開發者ID:ebean-orm,項目名稱:ebean-mocker,代碼行數:5,代碼來源:DelegateFindSqlQuery.java

示例6: findUnique

import io.ebean.SqlQuery; //導入依賴的package包/類
@Override
public SqlRow findUnique(SqlQuery query, Transaction transaction) {
  return delegate.findUnique(query, transaction);
}
 
開發者ID:ebean-orm,項目名稱:ebean-mocker,代碼行數:5,代碼來源:DelegateFindSqlQuery.java

示例7: findEach

import io.ebean.SqlQuery; //導入依賴的package包/類
@Override
public void findEach(SqlQuery sqlQuery, Consumer<SqlRow> consumer, Transaction transaction) {
  delegate.findEach(sqlQuery, consumer, transaction);
}
 
開發者ID:ebean-orm,項目名稱:ebean-mocker,代碼行數:5,代碼來源:DelegateFindSqlQuery.java

示例8: findEachWhile

import io.ebean.SqlQuery; //導入依賴的package包/類
@Override
public void findEachWhile(SqlQuery sqlQuery, Predicate<SqlRow> consumer, Transaction transaction) {
  delegate.findEachWhile(sqlQuery, consumer, transaction);
}
 
開發者ID:ebean-orm,項目名稱:ebean-mocker,代碼行數:5,代碼來源:DelegateFindSqlQuery.java

示例9: createSqlQuery

import io.ebean.SqlQuery; //導入依賴的package包/類
/**
 * Return an SqlQuery for performing native SQL queries that return SqlRow's.
 *
 * @param sql the sql to create SqlQuery using native SQL.
 * @return the created SqlQuery.
 */
public SqlQuery createSqlQuery(String sql) {
  Assert.hasText(sql, "sql must has text");
  return ebeanServer.createSqlQuery(sql);
}
 
開發者ID:hexagonframework,項目名稱:spring-data-ebean,代碼行數:11,代碼來源:EbeanQueryChannelService.java

示例10: findList

import io.ebean.SqlQuery; //導入依賴的package包/類
List<SqlRow> findList(SqlQuery query, Transaction transaction); 
開發者ID:ebean-orm,項目名稱:ebean-mocker,代碼行數:2,代碼來源:InterceptFindSqlQuery.java

示例11: findUnique

import io.ebean.SqlQuery; //導入依賴的package包/類
SqlRow findUnique(SqlQuery query, Transaction transaction); 
開發者ID:ebean-orm,項目名稱:ebean-mocker,代碼行數:2,代碼來源:InterceptFindSqlQuery.java

示例12: findEach

import io.ebean.SqlQuery; //導入依賴的package包/類
void findEach(SqlQuery sqlQuery, Consumer<SqlRow> consumer, Transaction transaction); 
開發者ID:ebean-orm,項目名稱:ebean-mocker,代碼行數:2,代碼來源:InterceptFindSqlQuery.java

示例13: findEachWhile

import io.ebean.SqlQuery; //導入依賴的package包/類
void findEachWhile(SqlQuery sqlQuery, Predicate<SqlRow> consumer, Transaction transaction); 
開發者ID:ebean-orm,項目名稱:ebean-mocker,代碼行數:2,代碼來源:InterceptFindSqlQuery.java


注:本文中的io.ebean.SqlQuery類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。