本文整理匯總了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");
}
}
示例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;
}
示例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();
}
}
示例4: createSqlQuery
import io.ebean.SqlQuery; //導入依賴的package包/類
public SqlQuery createSqlQuery(String sql) {
return delegate.createSqlQuery(sql);
}
示例5: findList
import io.ebean.SqlQuery; //導入依賴的package包/類
@Override
public List<SqlRow> findList(SqlQuery query, Transaction transaction) {
return delegate.findList(query, transaction);
}
示例6: findUnique
import io.ebean.SqlQuery; //導入依賴的package包/類
@Override
public SqlRow findUnique(SqlQuery query, Transaction transaction) {
return delegate.findUnique(query, transaction);
}
示例7: findEach
import io.ebean.SqlQuery; //導入依賴的package包/類
@Override
public void findEach(SqlQuery sqlQuery, Consumer<SqlRow> consumer, Transaction transaction) {
delegate.findEach(sqlQuery, consumer, transaction);
}
示例8: findEachWhile
import io.ebean.SqlQuery; //導入依賴的package包/類
@Override
public void findEachWhile(SqlQuery sqlQuery, Predicate<SqlRow> consumer, Transaction transaction) {
delegate.findEachWhile(sqlQuery, consumer, transaction);
}
示例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);
}
示例10: findList
import io.ebean.SqlQuery; //導入依賴的package包/類
List<SqlRow> findList(SqlQuery query, Transaction transaction);
示例11: findUnique
import io.ebean.SqlQuery; //導入依賴的package包/類
SqlRow findUnique(SqlQuery query, Transaction transaction);
示例12: findEach
import io.ebean.SqlQuery; //導入依賴的package包/類
void findEach(SqlQuery sqlQuery, Consumer<SqlRow> consumer, Transaction transaction);
示例13: findEachWhile
import io.ebean.SqlQuery; //導入依賴的package包/類
void findEachWhile(SqlQuery sqlQuery, Predicate<SqlRow> consumer, Transaction transaction);